Skip to content

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

Description

@shane-click

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:agentsarea:mcpbugSomething isn't workinghas reproHas detailed reproduction stepsplatform:macosIssue specifically occurs on macOSstaleIssue is inactive

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions