[BUG] MCP tools with oneOf/allOf/anyOf in schema cause unrecoverable session crash
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
When a third-party MCP server exposes a tool whose inputSchema contains oneOf, allOf, or anyOf at the top level, the Claude API rejects the request. Because Claude Code sends the full tool list with every API call, the error repeats on every subsequent request, making the session completely unrecoverable. Only /quit works.
Related to #43916 (built-in tool schemas), but this is the MCP-specific variant: Claude Code passes MCP tool schemas through to the API unmodified, with no validation or normalization. Unlike built-in tool issues, this can't be fixed by updating Claude Code's tool bundle.
Claude Desktop handles the same MCP server without issue, suggesting it normalizes schemas before sending them to the API.
What Should Happen?
Claude Code should either:
- Normalize incompatible JSON Schema keywords (
oneOf/allOf/anyOf) in MCP tool schemas before sending them to the API (as Claude Desktop appears to do) - Or catch the API validation error per-tool, disable the offending tool, and warn the user
The session should never become unrecoverable due to a single tool's schema.
Error Messages/Logs
API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"tools.11.custom.input_schema: input_schema does not support oneOf, allOf, or anyOf at the top level"},"request_id":"req_011CZr1kf8NdxBHLJYyB5cTT"}
This error repeats on every subsequent API call (tool use, agent spawn, even plain messages) until the session is quit.
Steps to Reproduce
- Install an MCP server whose tool schema uses
anyOfat the top level. The Fantastical MCP connector (v1.1.0) is one example. ItsmodifyCalendarItemtool has:
``json``
"inputSchema": {
"anyOf": [
{"required": ["id", "title"]},
{"required": ["id", "when"]}
],
"properties": {
"id": {"type": "string"},
"title": {"type": "string"},
"when": {"type": "string"}
},
"type": "object"
}
- Start a Claude Code session
- Trigger loading of the MCP tool (e.g., via
ToolSearchor by asking Claude to use it) - Every API call from that point forward fails with the 400 error above
- No recovery is possible without
/quit
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.96 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
iTerm2
Additional Information
Workaround: A stdio proxy script between Claude Code and the MCP binary that intercepts tools/list responses and strips anyOf/oneOf/allOf, replacing with a flattened equivalent (e.g., "required": ["id"]).
Why this is distinct from #43916: That issue covers Claude Code's own built-in tools shipping invalid schemas. This issue is about Claude Code lacking resilience to third-party MCP servers that use valid JSON Schema features the Claude API doesn't support. The fix path is different: schema normalization or graceful degradation for MCP-sourced tools, not just fixing one built-in tool definition.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗