{} LLM JSON Schema View source ↗

Anthropic · tool input_schema

tools.0.custom.input_schema: input_schema does not support oneOf, allOf, or anyOf at the top level

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:

# before — union at the root → 400 rejected { "oneOf": [ { "type": "object", "properties": { "email": { "type": "string" } } }, { "type": "object", "properties": { "phone": { "type": "string" } } } ] } # after — object root; the union lives inside a property { "type": "object", "properties": { "contact": { "anyOf": [ { "type": "object", "properties": { "email": { "type": "string" } }, "required": ["email"] }, { "type": "object", "properties": { "phone": { "type": "string" } }, "required": ["phone"] } ] } }, "required": ["contact"] }

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.

Open the converter →
Anthropic tool-use docs ↗