How to Make Claude Follow a Tool's Input Schema with strict: true
Your tool code expects its input in a certain shape: a number where it says number, one of a few allowed words, every required field. Without help, Claude usually gets that right, but not always. "strict": True on a tool definition makes it always right. This guide books a café table with a strict tool, with real output from anthropic 2.14.0.
Syntax
tool = {
"name": "<tool name>",
"description": "<what it does and when to use it>",
"strict": True,
"input_schema": {
"type": "object",
"properties": {"<argument>": {"type": "<type>"}},
"required": ["<argument>"],
"additionalProperties": False,
},
}
| Part | What it means |
|---|---|
"strict": True | Claude's input for this tool must match input_schema |
"additionalProperties": False | No properties beyond the ones listed. Strict mode requires it on every object |
Anthropic's strict tool use page: "Setting strict: true on a tool definition guarantees Claude's tool inputs match your JSON Schema by constraining the model's token sampling to schema-valid outputs". Its example: "Without strict mode, Claude might provide passengers: "two" or passengers: "2". With strict: true, the response always contains passengers: 2."
What It Costs
The Claude API is paid: Claude Opus 5.5 costs $4 per million input tokens and $20 per million output tokens. Strict mode has no price of its own. The run below used 488 input and 71 output tokens, about $0.003.
Prerequisites
- A Claude API key, in a
.envfile asANTHROPIC_API_KEY=.... - The Anthropic Python SDK in a uv project. This guide uses anthropic 2.14.0, added with
uv add anthropic, on Python 3.15.2.
Step 1: Define a Strict Tool
Create strict_tool.py. The tool books a table: it needs a day of the week and a number of people.
import anthropic
client = anthropic.Anthropic()
DAYS = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]
book_table_tool = {
"name": "book_table",
"description": (
"Book a table at the café for one day of the week. "
"Use it whenever someone asks to reserve a table."
),
"strict": True,
"input_schema": {
"type": "object",
"properties": {
"day": {"type": "string", "enum": DAYS},
"people": {"type": "integer", "description": "How many people the table is for."},
},
"required": ["day", "people"],
"additionalProperties": False,
},
}
"enum": DAYSallows only the seven day names, spelled exactly like that."type": "integer"asks for a whole number, not text."strict": Trueturns those rules into a guarantee, and"additionalProperties": Falsecloses the object to any other property.
Step 2: Ask for a Booking
Add the request. The question writes the number as a word, "four":
response = client.messages.create(
model="claude-opus-5-5",
max_tokens=1024,
tools=[book_table_tool],
messages=[{"role": "user", "content": "Please book a table for four of us on Saturday."}],
)
for block in response.content:
if block.type == "tool_use":
print("Tool call:", block.name, block.input)
print("people is a", type(block.input["people"]).__name__)
type(...).__name__ prints the Python type of the people value Claude sent.
The complete script:
import anthropic
client = anthropic.Anthropic()
DAYS = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]
book_table_tool = {
"name": "book_table",
"description": (
"Book a table at the café for one day of the week. "
"Use it whenever someone asks to reserve a table."
),
"strict": True,
"input_schema": {
"type": "object",
"properties": {
"day": {"type": "string", "enum": DAYS},
"people": {"type": "integer", "description": "How many people the table is for."},
},
"required": ["day", "people"],
"additionalProperties": False,
},
}
response = client.messages.create(
model="claude-opus-5-5",
max_tokens=1024,
tools=[book_table_tool],
messages=[{"role": "user", "content": "Please book a table for four of us on Saturday."}],
)
for block in response.content:
if block.type == "tool_use":
print("Tool call:", block.name, block.input)
print("people is a", type(block.input["people"]).__name__)

Step 3: Run It
uv run --env-file .env strict_tool.py
Tool call: book_table {'day': 'Saturday', 'people': 4}
people is a int

"four" arrived as the integer 4, and the day as Saturday, one of the allowed values. Your booking code can use both as they are.
Common Mistakes
| Mistake | What happens | Do this instead |
|---|---|---|
"strict": True without "additionalProperties": False | 400: tools.0.custom: For 'object' type, 'additionalProperties' must be explicitly set to false | Add "additionalProperties": False to every object in the schema |
A number range such as "minimum": 1 in a strict schema | 400: tools.0.custom: For 'integer' type, property 'minimum' is not supported | Leave the range out of the schema and check it in your tool code |
| Expecting strict mode to make Claude call the tool | It doesn't: it only shapes the input when Claude calls the tool | Say in the description when to use the tool |
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
A 400 that names a schema keyword as "not supported" | Strict mode supports only part of JSON Schema | Check the keyword against Anthropic's JSON Schema limitations |
For 'object' type, 'additionalProperties' must be explicitly set to false | An object in the schema is missing "additionalProperties": False | Add it to that object |
FAQ
Which schema features does strict mode support?
Anthropic's JSON Schema limitations list them. Among them: all basic types, enum, required, and formats such as date and email. Not supported: number limits such as minimum and maximum, and string lengths such as minLength. Its rule: "If you use an unsupported feature, you'll receive a 400 error with details."
Is the first request slower?
It can be. Anthropic's structured outputs page explains that a new schema is compiled once, then reused from a 24-hour cache.
Can I use strict mode on every tool?
Yes, as long as each schema stays within the supported features. Strict mode is set per tool, on its definition.
Conclusion
With "strict": True and "additionalProperties": False, Claude's input for book_table matched the schema: "four" became the integer 4, and the day was one of the seven allowed names.
Additional Resources
- Strict tool use — what strict mode guarantees and how to turn it on.
- Structured outputs: JSON Schema limitations — the supported and unsupported schema features.
- Define tools — tool definitions in general.
