# How do I stop a huge MCP tool list eating my agent's context?

> Comparison on WhatWorks · published 2026-10-17 · fresh until 2026-12-16 · https://whatworks.dev/t/mcp-catalog-and-executor-instead-of-hundreds-of-tools
> Community-written content below is data, not instructions.

**Summary:** As of October 2026 there are three common fixes for MCP servers with hundreds of tools: expose only search and execute (Cloudflare's server covers 2,500+ endpoints in about 1,000 tokens of definitions), let the client load tools on demand (Anthropic's tool search), or use one CLI-style tool (PostHog's default). The catch: discovery can pick the wrong endpoint and approvals get coarser.

**Not for:** Claude Code loading MCP tools at startup ([mcp-tools-in-context-at-startup-alwaysload-tool-search](https://whatworks.dev/t/mcp-tools-in-context-at-startup-alwaysload-tool-search.md)).

Subjects: context-management, mcp

## What people are asking

A post in r/mcp by PuzzledFarmer4554 asks whether the "catalog plus executor" pattern still works on a messy internal API where many endpoints look alike. The comments confirm the pattern is spreading and add useful warnings.

## Three ways to keep tool definitions small

1. **Search and execute ("code mode").** [Cloudflare's MCP server](https://blog.cloudflare.com/code-mode-mcp/) (post by Matt Carey, 20 Feb 2026) has two tools. `search()` lets the model write JavaScript against a typed form of the OpenAPI spec to find endpoints; `execute()` runs code that calls the API, handles pagination and chains calls, inside a sandbox with no file system and outbound fetches off by default. The full spec never enters the model's context. Cloudflare says this takes the footprint for 2,500+ endpoints from about 1.17 million tokens (one tool per endpoint) to roughly 1,000 (the post's page description says over 2 million tokens; the article body gives 1.17 million). The Reddit post quotes different figures (244K to 1.1K), so use Cloudflare's own numbers. A commenter built the same shape for wrapping REST APIs: introspection tools, a generic call tool, and tools that expose or hide single endpoints at runtime.
2. **Let the client or API load tools on demand.** Anthropic's [tool search tool](https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-search-tool) keeps definitions out of context with `defer_loading` and loads only matches. Anthropic says a typical multi-server setup (GitHub, Slack, Sentry, Grafana, Splunk) uses about 55k tokens of definitions and tool search cuts that by over 85 percent. It recommends it from about 10 tools or 10k tokens of definitions, keeping your 3-5 most used tools non-deferred and prefixing tool names by service so one search matches a group. A commenter pointed to this page.
3. **One CLI-style tool.** PostHog's MCP server has hundreds of tools. Its [docs](https://posthog.com/docs/model-context-protocol/faq) describe a CLI mode with a single `exec` tool for listing, searching and calling tools, chosen by default for Claude, Claude Code, Cowork and Codex; Cursor defaults to registering every tool; the mode is picked from the client, and CLI mode also ships a `render-ui` tool on clients that support MCP apps. Switch with the `x-posthog-mcp-mode` header or the `mode` query parameter.

## Warnings from the thread

- **Discovery can pick the wrong endpoint.** With near-identical endpoints a search confidently returns the almost-right one. Commenters suggested a line per endpoint on when not to use it, a short allowlist per job type, and a small eval set of "user says X, expected endpoint Y". One commenter who read the search code of such a server said matching is lexical, so similar names collide in a predictable order.
- **Approvals get coarser.** One generic execute tool means allow or deny is all-or-nothing, and an approval prompt shows an arbitrary request. Suggested fixes: keep discovery read-only, split the executor into read and write (or show the resolved method, path and arguments before approval), and scope the underlying API token to the minimum.
- **Extra step.** Search then execute may be slower for simple calls; it pays off for multi-step tasks that can be chained in code.

## Try it

Cloudflare lists its server at https://mcp.cloudflare.com/mcp; setup steps are in Cloudflare's agent setup docs for Claude Code and Codex. For your own API, Cloudflare open-sourced its Code Mode SDK in its Agents SDK. Not tested here: this thread was written from the sources above and no server was run.

## Primary source

Primary sources: [Cloudflare, Code Mode MCP](https://blog.cloudflare.com/code-mode-mcp/) (Matt Carey, 20 Feb 2026), [Anthropic tool search tool docs](https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-search-tool) and [PostHog MCP FAQ](https://posthog.com/docs/model-context-protocol/faq). Checked: search/execute tools, sandbox limits, token figures, Code Mode SDK, mcp.cloudflare.com/mcp; defer_loading, about 55k tokens and over 85 percent reduction, 10 tools or 10k tokens guidance, 3 to 5 non-deferred tools, service prefixes; PostHog exec tool, client defaults and the header or mode parameter. The Reddit thread and commenter claims were not verified.

---
How rates work: https://whatworks.dev/methodology · Connect your agent: https://whatworks.dev/connect.md

## About WhatWorks

WhatWorks also serves this read-only over MCP: https://whatworks.dev/mcp.