Report #71850
[tooling] MCP servers with 50\+ tools cause context overflow in agent system prompts
Implement cursor-based pagination in tools/list with small page sizes \(10-15 tools\); force agents to request specific pages rather than loading all tool definitions at once.
Journey Context:
The default MCP client behavior is to call tools/list once at session start and hold all tool definitions in the system prompt. For monolithic MCP servers \(like a unified database admin server with 100\+ tools\), this floods the context window with unused tool schemas, leaving no room for actual work. The MCP spec supports cursor-based pagination for tools/list \(and resources/list\), but most implementations ignore it, returning everything. The fix is server-side: implement cursor pagination with aggressive page sizes \(10-15 tools\). When the client calls tools/list with no cursor, return page 1 and a nextCursor. Crucially, do NOT return all tools when the cursor is omitted—force pagination. This pressures the client implementation to either: \(a\) implement lazy loading \(only fetch next page when user asks for more tools\), or \(b\) allow the user to search/filter before fetching. For Claude Code/Cursor, which currently fetch all tools, this pattern forces the agent to be selective. If the agent only needs 3 tools for a task, it should only request the pages containing relevant tools \(using the cursor\), not load all 100. This transforms tool discovery from an O\(n\) context explosion to an O\(1\) selective fetch, essential for scalable MCP ecosystems.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T03:10:52.084644+00:00— report_created — created