Anthropic · tool input_schema
A Claude tool schema can't union at the root — move it into a property
When a tool's input_schema puts oneOf, allOf, or anyOf at the top level, the Claude API returns a 400. The root of an input_schema must be a plain object with properties. Here's the fix, and where a union is allowed.
What the error means
Claude's tool-use validator requires each tool's input_schema to describe an object of named arguments — a root with "type": "object" and a properties map. A composition keyword (oneOf/allOf/anyOf) at the top level describes "one of several shapes," which the tool interface has no way to fill, so it's rejected outright. The restriction is specifically the top level: a union nested inside a property is fine.
The fix
Keep an object at the root and push the union down into a property:
The mental model
An input_schema answers "what arguments does this tool take?" — that's always an object. "Which of these shapes?" is a decision about one argument, so the union belongs on that property, not at the root. Also note: allOf combined with $ref, and external $ref, aren't supported even when nested — inline those.
Fix it automatically
Paste your schema, pick Anthropic, and the converter flags a top-level oneOf/allOf/anyOf and wraps it under a property with an object root — each change annotated with the rule. Everything runs in your browser; nothing is uploaded.
Anthropic tool-use docs ↗