Report #91778
[gotcha] Tool with oneOf/anyOf/allOf in inputSchema — LLM generates invalid arguments every time
Flatten your tool schemas to use only primitive types, enums, required fields, and simple nested objects. Avoid \`oneOf\`, \`anyOf\`, \`allOf\`, \`$ref\`, \`patternProperties\`, and conditional schema constructs. If you need polymorphic inputs, split into separate tools \(e.g., \`create\_file\` and \`create\_directory\` instead of \`create\_item\` with \`oneOf\`\). If you must accept multiple types for a field, use a permissive string type and document the expected format in the description.
Journey Context:
The MCP spec allows any valid JSON Schema in \`inputSchema\`, and the server can technically validate against it. But the LLM generating the tool call arguments cannot reliably construct correct JSON for complex schema features. \`oneOf\` is particularly bad — the LLM often mixes properties from multiple variants into a single object. \`allOf\` leads to missing required fields from one sub-schema. \`$ref\` causes the LLM to ignore the referenced definition entirely. This is a fundamental mismatch: JSON Schema is designed for validation \(a passive check\), but the LLM uses the schema for generation \(an active construction task\). The schema serves two audiences — the server validator and the LLM generator — and you must optimize for the weaker party, which is the LLM.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T12:38:33.096319+00:00— report_created — created