Claude Tool Use Failed Validation
Your tool definitions don't match Claude's schema requirements. Common with copy-pasted OpenAI function schemas, missing input_schema, or invalid JSON Schema syntax.
Claude tools require exactly three top-level fields: name, description, and input_schema. The schema uses input_schema (NOT parameters like OpenAI). Type must be "object" with a properties map and an optional required array.
The Error Message You're Seeing
HTTP/1.1 400 Bad Request
{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "tools.0: Field required 'input_schema'"
}
}
Common variants: "tools.0.input_schema.type: must be 'object'", "tools.0.name: does not match required pattern", "tool_choice.name: not found in tools".
What Actually Causes This Error
parameters; Anthropic uses input_schema. Direct copy-paste fails.^[a-zA-Z0-9_-]{1,64}$. Spaces, dots, and special characters rejected.input_schema root must have type: "object" explicitly.oneOf) or malformed property definitions.tool_choice: {name: "get_weather"} but no tool named "get_weather" in the tools array.Fixes That Work (Tested Nov 2026)
1Use the Correct Anthropic Schema Format
OpenAI: {name, description, parameters: {...}}. Anthropic: {name, description, input_schema: {...}}. The nested structure is nearly identical — just rename parameters to input_schema.
2Validate Tool Names Against Regex
3Handle tool_choice Correctly
Preventing This Error Going Forward
- Define tool schemas as typed classes. Use Pydantic (Python) or Zod (TypeScript) — generate JSON schema automatically.
- Validate tools on startup. Fail fast if a tool schema is malformed.
- Test with a minimal example first. Verify tool structure with a simple 1-parameter tool before adding complexity.
- Don't use unsupported JSON Schema keywords. Claude supports a subset — avoid
oneOf,allOf,if/then/else. - Keep tool descriptions clear and specific. Better descriptions reduce Claude's tool-selection errors.
Researcher · AI Error Hub
Frequently Asked Questions
A subset. Supported: type, properties, required, enum, description, nested objects/arrays. Unsupported (or unreliable): oneOf, anyOf, allOf, if/then/else, $ref. Stick to the supported subset for reliability.
No hard cap documented, but performance degrades with 20+ tools. If you have many tools, group them by domain and use dynamic selection to pass only relevant tools per request.
No. Names must match ^[a-zA-Z0-9_-]{1,64}$ — letters, numbers, underscores, and hyphens only. Use underscores for namespacing: weather_get_current instead of weather/get-current.
Even with forced tool use, Claude may include a brief text response before or after the tool call. If you need pure structured output, parse only the tool_use block and ignore text blocks. Or use structured outputs when available.
Yes — dramatically improves tool selection accuracy. Format: "Use this when the user asks about X. Example: 'What's the weather?' → get_weather(location='Karachi')". Claude uses these signals heavily.
Related Errors
Master Tool Use in Claude
Weekly tips on tool design, structured outputs, and agentic workflows. 12,000+ developers subscribe.
Subscribe Free →