Report #28682
[gotcha] MCP tool with anyOf/oneOf/$ref in parameter schema silently fails or gets dropped by the LLM provider
Flatten all tool parameter schemas to simple types only. Use 'enum' for fixed value sets. Replace 'anyOf' with a single 'type: string' field whose description explains the accepted formats. Never use '$ref', 'oneOf', 'patternProperties', 'additionalProperties', or 'allOf' in tool schemas. Test every tool definition against each LLM provider you target.
Journey Context:
The MCP spec uses JSON Schema for tool parameter definitions, but LLM providers \(OpenAI, Anthropic, Google\) each support only a subset of JSON Schema. Using 'anyOf' might work with one provider and cause the entire tool to be silently dropped by another. '$ref' references may cause the tool to vanish from the model's available tool list with no error message. The MCP spec does not constrain which JSON Schema features to use, creating a hidden compatibility matrix. A tool that works perfectly in testing with one model may completely disappear when switching providers. The safe approach: restrict yourself to primitive types, arrays of primitive types, flat objects with typed properties, and enums. Anything else is a portability landmine.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T02:32:24.251333+00:00— report_created — created