Explore agent always fails with "Prompt is too long" when many MCP tools are connected

Status Open
Maintainer reply None cached
Activity 6 comments · opened Mar 25, 2026

Description

The Explore subagent (subagent_type: "Explore") consistently fails to launch with Prompt is too long when the parent session has many MCP server integrations connected. The agent never executes a single tool call — it fails immediately on spawn.

Steps to Reproduce

  1. Have multiple MCP integrations connected (Claude.ai integrations like PostHog, Asana, Gmail, Google Calendar, Slack, Circleback + local MCP servers like Playwright, Chrome, Context7, GitHub)
  2. Spawn an Explore agent with any prompt:

``
Agent(subagent_type="Explore", prompt="Search for how chat responses are streamed")
``

Expected Behavior

Explore agent starts and performs the search.

Actual Behavior

Prompt is too long
agentId: aef62ee12afe5392a
total_tokens: 0
tool_uses: 0
duration_ms: 789

The agent returns immediately with zero tokens used and zero tool calls. This happens 100% of the time regardless of how short the user prompt is.

Analysis

The likely cause is MCP tool definitions filling the subagent's context window. In our setup:

  • ~230+ MCP tools are listed as deferred tools (PostHog ~100, Playwright ~20, GitHub ~30, Asana ~20, plus Gmail, Calendar, Slack, Circleback, Chrome, Context7)
  • Even as deferred name-only listings, 230+ tool names plus MCP server instruction blocks and skill definitions add up significantly
  • The CLAUDE.md files are only ~30KB — small relative to context limits

The Explore agent description says it has access to "All tools except Agent, ExitPlanMode, Edit, Write, NotebookEdit". If it inherits all MCP tool definitions from the parent session, that's the bottleneck. The general-purpose Agent works fine with the same project, presumably because it has a larger context budget.

The Explore agent should either:

  1. Not inherit MCP tool definitions it can't use (it only needs Read, Grep, Glob, Bash, LS)
  2. Use a model with sufficient context for the inherited tool set
  3. Strip MCP tools from the subagent context since Explore is specifically for codebase navigation

Workaround

Use Glob and Grep tools directly, or use the general-purpose Agent type.

Environment

  • macOS (Darwin 25.2.0, arm64)
  • Claude Code CLI
  • Model: claude-opus-4-6 (1M context)
  • ~230+ MCP tools across 10+ integrations

View original on GitHub ↗

6 Comments

github-actions[bot] · 5 months ago

Found 2 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/37793
  2. https://github.com/anthropics/claude-code/issues/38678

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

marvtub · 5 months ago

Also hitting this consistently on macOS (Darwin 25.2.0, arm64) with Claude Code CLI on Opus 4.6 (1M context).

My setup has ~6 MCP servers in .mcp.json (Sentry, Linear, Figma, Playwright, Datadog, GraphQL) plus cloud integrations (PostHog, Ahrefs, Notion, Stripe, n8n, MongoDB, Chrome). The deferred tool list easily exceeds 300+ tool names.

Every Explore agent spawn fails immediately with Prompt is too long — 0 tool uses, 0 tokens, ~1s duration. General-purpose agents work fine since they use the parent model's 1M context window.

Confirming the analysis: the root cause is MCP tool definitions being injected into the Explore agent's Haiku context (200K limit). Even with a one-line prompt, it's already over budget before any work begins.

Using general-purpose agents as a workaround for now.

tavaresgmg · 4 months ago

Additional data point — Claude Opus 4.6 (1M context), 8 MCP servers

Same issue here. Explore agents fail consistently, and even general-purpose agents sometimes hit autocompact thrashing.

Setup:

  • Model: claude-opus-4-6 (1M context window)
  • MCP servers (8): MemPalace (custom, ~20 tools), TickTick (~25 tools), Gmail, Google Calendar, Linear (~25 tools), Exa (~6 tools), Context7 (~2 tools), Sequential Thinking (~1 tool)
  • Estimated total deferred tools: ~150+
  • Skills (superpowers plugin): ~15 skills loaded
  • CLAUDE.md: ~8KB

Observed behavior:

  • Explore agent: fails 100% of the time. Either "Prompt is too long" or autocompact thrashing ("context refilled to the limit within 3 turns of the previous compact, 3 times in a row")
  • General-purpose agent: fails ~30% of the time with autocompact thrashing when given research tasks that involve reading tool results
  • Plan agent: works reliably (fewer tool calls, smaller results)
  • Main conversation: works perfectly with all 150+ tools — no context pressure at all

Workaround attempted: None effective. The only option is to avoid Explore agents entirely and use Grep/Glob/Read directly from the main conversation, which defeats the purpose of delegation.

Suggestion: Subagents should receive a filtered tool set. An Explore agent only needs Read, Grep, Glob, Bash, and WebSearch/WebFetch — inheriting 150 MCP tool definitions it will never use is pure context waste. The feature request in #38044 would solve this.

Session: 5h+ deep session, 2026-04-07, macOS Darwin 25.4.0.

aak204 · 4 months ago

Explore mode inheriting the entire MCP universe makes it almost unusable on heavy setups. If anyone is blocked by this, I put together a lightweight Go proxy (toolc) that mitigates it. You can point Explore at a compiled, filtered endpoint instead of the raw servers. It's just a band-aid until Claude Code fixes subagent inheritance, but it does the job today.
Repo: https://github.com/aak204/Tool-Catalog-Compiler

dereekb · 3 months ago

I ran into this myself. Claude suggested actually creating a custom Explore subagent that override the default Explore. The agent is then configured to not have access to the MCP tools. Seems to have worked as I'm not getting the same issue.

jonhenshaw · 2 months ago

+1 this is a huge blocker