MCP tool with invalid JSON Schema property key breaks entire session irrecoverably
Resolved 💬 4 comments Opened Mar 15, 2026 by lgacnik Closed Apr 13, 2026
Description
When an MCP server exposes a tool whose input schema contains a property key with characters outside the pattern ^[a-zA-Z0-9_.-]{1,64}$ (e.g., $.xgafv from Google APIs), the Anthropic API returns a 400 error. This is expected validation behavior, but the failure mode is catastrophic: the entire Claude Code session becomes permanently unusable.
Reproduction
- Configure an MCP server that exposes a tool with a property key containing
$(or any char outside[a-zA-Z0-9_.-]) - Use
ToolSearchto load that tool into the session - Every subsequent prompt — including completely unrelated ones like "hello" — fails with:
API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"tools.42.custom.input_schema.properties: Property keys should match pattern '^[a-zA-Z0-9_.-]{1,64}'"}}
- The only recovery is
/clearto reset the conversation context
Issues
- Session-breaking failure mode: A single invalid tool poisons the entire tool list, which is sent with every API request. There's no way to unload it or recover without clearing the session.
- No graceful degradation: The API could reject/skip the individual invalid tool rather than failing the entire request. Alternatively, Claude Code could catch this error and remove the offending tool from the active set.
- Unhelpful error message: The error says
tools.42(by index) but doesn't identify the tool name or the specific invalid property key, making debugging difficult.
Expected behavior
- Invalid MCP tool schemas should not break the entire session
- At minimum, Claude Code should detect this error pattern and either remove the offending tool or inform the user which tool is problematic
- Ideally, the API would skip invalid tools and proceed with the valid ones
Environment
- Claude Code CLI (claude-opus-4-6)
- Linux
- MCP server: locally generated server for Google Drive API (parameter
$.xgafvhas$in property key)
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗