Problem
When a user has many MCP servers configured at the user level, subagents (Explore, Plan, general-purpose) fail immediately with prompt is too long: 209117 tokens > 200000 maximum before executing a single tool call. The TUI shows Done (0 tool uses · 0 tokens · 44s) with no error visible to the user.
Root Cause
Subagents inherit all MCP tool definitions from the parent session. Each tool definition includes a full JSON schema. With many MCP servers, the tool schemas alone exceed Sonnet's 200k context limit.
Reproduction
Setup: 34 MCP servers configured in ~/.claude.json (Bright Data, Discord, GitHub, Gmail, Playwright, Sentry, YouTube, etc.) totaling ~566 MCP tools.
Main session: Opus 4.6 (1M context) on Claude Max — works fine, 209k of tool schemas fits within 1M.
Subagent spawn: Any Agent call (Explore, Plan, general-purpose) → Sonnet 200k → immediate API error:
"error": "invalid_request"
"errorDetails": "prompt is too long: 209117 tokens > 200000 maximum"
The user prompt was ~156 tokens. The Explore system prompt is ~500 tokens. The remaining ~208,000 tokens are tool definitions.
Subagent JSONL evidence (from agent-a4ff9338a6a5a0f09.jsonl):
{
"error": "invalid_request",
"errorDetails": "400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"prompt is too long: 209117 tokens > 200000 maximum\"}}"
}
Version: Claude Code v2.1.81, macOS, Claude Max subscription.
Why This Isn't a Duplicate
Previous issues were auto-closed incorrectly:
The underlying problem — subagents receiving all MCP tool schemas regardless of relevance, causing context overflow — remains unfixed.
Proposed Solutions (any would work)
- Apply deferred/ToolSearch to subagents — The main session already uses deferred tools (tool names listed, schemas loaded on demand via ToolSearch). Subagents should get the same treatment.
- Filter tools by subagent type — Explore agents don't need Canva, Stripe, Discord, etc. Only pass tools relevant to the subagent's declared tool set.
- Inherit parent model — If the main session is Opus 1M, subagents should also get 1M context (or at least Sonnet 1M if available on the plan).
- Graceful degradation — If tool definitions exceed the subagent's context, prune least-relevant MCP tools rather than failing silently.
Workarounds
- Pass
model: "opus" explicitly on Agent calls (costs more quota)
- Reduce MCP servers in
~/.claude.json (defeats the purpose of having them)
- Move servers to project-level configs (tedious, easy to forget)
Impact
Any Claude Max user with 15+ MCP servers will hit this. The failure is completely silent in the TUI — users see "0 tool uses · 0 tokens" and have no idea why. This makes Explore, Plan, and general-purpose agents unusable for power users.
Problem
When a user has many MCP servers configured at the user level, subagents (Explore, Plan, general-purpose) fail immediately with
prompt is too long: 209117 tokens > 200000 maximumbefore executing a single tool call. The TUI showsDone (0 tool uses · 0 tokens · 44s)with no error visible to the user.Root Cause
Subagents inherit all MCP tool definitions from the parent session. Each tool definition includes a full JSON schema. With many MCP servers, the tool schemas alone exceed Sonnet's 200k context limit.
Reproduction
Setup: 34 MCP servers configured in
~/.claude.json(Bright Data, Discord, GitHub, Gmail, Playwright, Sentry, YouTube, etc.) totaling ~566 MCP tools.Main session: Opus 4.6 (1M context) on Claude Max — works fine, 209k of tool schemas fits within 1M.
Subagent spawn: Any Agent call (Explore, Plan, general-purpose) → Sonnet 200k → immediate API error:
The user prompt was ~156 tokens. The Explore system prompt is ~500 tokens. The remaining ~208,000 tokens are tool definitions.
Subagent JSONL evidence (from
agent-a4ff9338a6a5a0f09.jsonl):{ "error": "invalid_request", "errorDetails": "400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"prompt is too long: 209117 tokens > 200000 maximum\"}}" }Version: Claude Code v2.1.81, macOS, Claude Max subscription.
Why This Isn't a Duplicate
Previous issues were auto-closed incorrectly:
The underlying problem — subagents receiving all MCP tool schemas regardless of relevance, causing context overflow — remains unfixed.
Proposed Solutions (any would work)
Workarounds
model: "opus"explicitly on Agent calls (costs more quota)~/.claude.json(defeats the purpose of having them)Impact
Any Claude Max user with 15+ MCP servers will hit this. The failure is completely silent in the TUI — users see "0 tool uses · 0 tokens" and have no idea why. This makes Explore, Plan, and general-purpose agents unusable for power users.