Deferred MCP tool name catalog consumes excessive context even with lazy loading
Resolved 💬 1 comment Opened Feb 26, 2026 by abl030 Closed Feb 26, 2026
Problem
When using multiple MCP servers with many tools (e.g., pfSense ~400, UniFi ~200, Lidarr ~200, Home Assistant ~100, slskd ~100), the deferred tool name catalog is always present in the system prompt, consuming significant context window space.
The ToolSearch tool description enumerates every single deferred tool name — in our case ~1000+ names — on every message, even though lazy loading is supposed to minimize context impact.
Impact
- Context exhaustion — 1000+ tool names eat substantial tokens from every turn
- Subagent failures — Task tool subagents (e.g., Explore) inherit this catalog and fail with "Prompt is too long" even after
/compact, because the tool catalog alone is too large - Defeats lazy loading purpose — The full schema is deferred, but the name list isn't, so users with many MCP tools still get penalized
Expected behavior
Deferred tool names should NOT be enumerated in the system prompt. Instead:
ToolSearchshould work without needing the full name list in context (server-side lookup)- Or the name catalog should only be injected when
ToolSearchis actually called - Or subagents that don't have
ToolSearchavailable should not receive the catalog at all
Reproduction
- Configure 5+ MCP servers with many tools (pfSense, UniFi, Lidarr, Home Assistant, etc.)
- Start a conversation and observe the system prompt size
- Try spawning a Task/Explore subagent — it may fail with "Prompt is too long"
- Run
/compact— doesn't help because the tool catalog is in the system prompt, not conversation history
Environment
- Claude Code CLI
- Multiple MCP servers (~1000+ total tools)
- Model: claude-opus-4-6
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗