Bug Description
Explore subagents (launched via the Agent tool with subagent_type: Explore) fail immediately with an API 400 error. General-purpose agents work fine with the same configuration.
Error
API Error: 400 {"type":"error","error":{"type":"invalid_request_error",
"message":"tools.134.custom.input_schema.properties: Property keys should match pattern '^[a-zA-Z0-9_.-]{1,64}$'"}}
Root Cause
Multiple MCP tool plugins include a $schema key at the top level of their parameters object (a standard JSON Schema keyword):
- Playwright plugin:
"$schema": "https://json-schema.org/draft/2020-12/schema"
- Vercel integration:
"$schema": "http://json-schema.org/draft-07/schema#"
- Context7 plugin:
"$schema": "http://json-schema.org/draft-07/schema#"
The $ character in $schema does not match the Anthropic API's required pattern ^[a-zA-Z0-9_.-]{1,64}$.
Why general agents work but Explore agents don't
The general-purpose agent type appears to handle tool schemas differently (likely using deferred/lazy loading), so the API never sees the raw $schema key. The Explore agent type sends full tool schemas to the API upfront, triggering the validation error.
Reproduction Steps
- Have Playwright, Context7, or Vercel MCP tools enabled
- Launch an Explore subagent via the Agent tool
- The subagent immediately fails with the 400 error above
- Launch a general-purpose subagent with the same prompt — it works fine
Expected Behavior
Claude Code should strip JSON Schema meta-keywords ($schema, $id, etc.) from MCP tool input schemas before sending them to the Anthropic API, regardless of agent type.
Environment
- Claude Code CLI
- macOS (Darwin 25.3.0)
- Plugins: Playwright, Context7, TypeScript LSP, Frontend Design
- Connected integrations: Vercel, Gmail, GoDaddy, Twilio, Chrome
Bug Description
Explore subagents (launched via the Agent tool with
subagent_type: Explore) fail immediately with an API 400 error. General-purpose agents work fine with the same configuration.Error
Root Cause
Multiple MCP tool plugins include a
$schemakey at the top level of theirparametersobject (a standard JSON Schema keyword):"$schema": "https://json-schema.org/draft/2020-12/schema""$schema": "http://json-schema.org/draft-07/schema#""$schema": "http://json-schema.org/draft-07/schema#"The
$character in$schemadoes not match the Anthropic API's required pattern^[a-zA-Z0-9_.-]{1,64}$.Why general agents work but Explore agents don't
The general-purpose agent type appears to handle tool schemas differently (likely using deferred/lazy loading), so the API never sees the raw
$schemakey. The Explore agent type sends full tool schemas to the API upfront, triggering the validation error.Reproduction Steps
Expected Behavior
Claude Code should strip JSON Schema meta-keywords (
$schema,$id, etc.) from MCP tool input schemas before sending them to the Anthropic API, regardless of agent type.Environment