Explore subagents fail with API 400 error due to $schema in MCP tool schemas

Resolved 💬 3 comments Opened Mar 14, 2026 by shane-click Closed Apr 16, 2026

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

  1. Have Playwright, Context7, or Vercel MCP tools enabled
  2. Launch an Explore subagent via the Agent tool
  3. The subagent immediately fails with the 400 error above
  4. 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

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗