CCAPrep
← All labs
D2·Fix the code

A strict schema that isn't

This tool was marked strict so its inputs would always validate, but malformed arguments still reach the handler and the API never complained about the definition.

tools = [{
    "name": "book_flight",
    "description": "Book a flight.",
    "input_schema": {
        "type": "object",
        "properties": {
            "destination": {"type": "string"},
            "passengers": {"type": "integer"},
        },
        "required": ["destination", "passengers"],
    },
}]

response = client.messages.create(
    model="claude-opus-5",
    max_tokens=16000,
    tools=tools,
    tool_choice={"type": "auto", "strict": True},
    messages=messages,
)

1.Where does `strict` actually belong?

2.What else must the schema declare for strict mode to be valid?