Validate Claude tool definitions
Claude’s tool use relies on a precise tool schema, and a malformed input_schema
or a thin description leads to rejected requests or poor tool selection. Paste
your tool definition here and get an instant checklist against Anthropic’s
spec — name format, description quality, input_schema structure, property
types, and nesting depth — before you add it to your tools array.
How it works
The validator parses your JSON and checks the shape Anthropic expects: a flat
object with name, description, and input_schema. Unlike OpenAI’s nested
function.parameters, Anthropic puts the JSON Schema directly under
input_schema, which must be { "type": "object", "properties": { … } }. The
tool verifies the name matches the allowed pattern, the description is present
and substantive, every property declares a type, and the schema isn’t nested too
deeply for Claude to fill reliably.
What a valid Anthropic tool definition looks like
{
"name": "get_weather",
"description": "Fetch the current weather for a location. Call this when the user asks about weather conditions, temperature, or whether to bring an umbrella.",
"input_schema": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and country, e.g. London, UK"
},
"unit": {
"type": "string",
"enum": ["celsius", "fahrenheit"],
"description": "Temperature unit, defaults to celsius"
}
},
"required": ["location"]
}
}
What the validator checks
| Check | Why it matters |
|---|---|
Name matches ^[a-zA-Z0-9_-]{1,64}$ | Spaces or punctuation cause the API to reject the tool array |
| Description present and non-trivial | Claude selects tools primarily from descriptions; thin descriptions lead to missed or wrong calls |
input_schema is type: object | The API requires a JSON Schema object at the top level |
All properties declare a type | Untyped properties confuse Claude about what to fill in |
| Nesting depth is reasonable | Deeply nested schemas produce unreliable fills; flatten where possible |
Common mistakes
- Wrapping in a
functionkey. Anthropic’s format is flat —name,description,input_schemaat the top level. OpenAI wraps in{"type": "function", "function": {...}}; these are not interchangeable. - Omitting
required. Without arequiredarray Claude may leave out inputs you need, since it cannot distinguish truly optional from accidentally omitted fields. - Vague descriptions. “Looks up a value” is not enough. Describe what trigger should prompt Claude to call the tool and what each parameter controls.
- Free-form strings where enums work. If a field accepts only
"asc"or"desc", say so with an enum — it dramatically reduces hallucinated values.
Tips
- Write rich descriptions. Claude leans on the tool description more than most models; explain when to use the tool and what each field means.
- Use
requiredexplicitly so Claude knows which inputs it must provide. - Prefer enums and flat structures over free-form strings and deep nesting — they produce far more reliable tool calls.