# How to Reduce MCP Tool Definitions Token Usage Before Your Agent Starts

> Source: <https://startupfortune.com/how-to-reduce-mcp-tool-definitions-token-usage-before-your-agent-starts/>
> Published: 2026-12-01 13:10:17+00:00

**Recommendation:** Dump each MCP server's tool list with MCP Inspector and count definitions via Anthropic's token endpoint on your production model, then prune unused tools first, since Anthropic reports selection accuracy degrades past 30 to 50 tools.
More in the playbook "Designing agent systems": <https://wpnews.pro/playbooks/agent-architecture>

*Your agent pays for every tool you connect, whether or not it ever calls one. A short audit shows which servers earn their space and which fix to try first.*

- Count each server's definitions with Anthropic's free token counting endpoint, then count them all together on the model you actually run.
- Pruning comes first because a tool you switch off takes no space and can't be picked by mistake.
- Anthropic puts the typical saving from tool search at more than 85 percent, in exchange for an extra search step.
- Prompt caching cuts the price of repeated definitions but frees no room in the context window.
- Code execution has a dramatic published saving, but you have to run and secure a sandbox for code your agent writes.

Five MCP servers, 58 tools and roughly 55,000 tokens used up before the conversation starts: that's a setup Anthropic described in November 2025. GitHub accounted for about 26,000 of those tokens with 35 tools, while Slack needed about 21,000 for just 11. Sentry, Grafana and Splunk made up the rest, and adding Jira would have cost around 17,000 more. If you're working out how to reduce MCP tool definitions token usage, start by finding your own version of that bill, because tool count alone won't tell you where it comes from.

Each definition carries a name, a description and a JSON Schema for its inputs. When your client loads them up front, the model receives all of it as input on every request, including each step of a tool loop. Anthropic says it has seen definitions reach 134,000 tokens before anyone optimized them.

You can lose accuracy along with the space. Anthropic's documentation says Claude's ability to pick the right tool degrades once more than 30 to 50 are available. A May 2025 paper on a method called RAG-MCP reported 43.13% tool selection accuracy when relevant tools were retrieved first, against 13.62% for its baseline. If you've been blaming the model for calling the wrong search function, look at how many search functions you handed it.

In Claude Code, run /context to see what's filling the window and /mcp to see which servers are connected. Tool search is on by default there, so a typical setup loads only tool names and server instructions at the start. Some configurations still load everything, including sessions where ENABLE_TOOL_SEARCH is set to false and certain older models and hosting platforms, so check instead of assuming.

[How to Write AI Agent Tool Descriptions That Stop Wrong Tool Calls](https://startupfortune.com/how-to-write-ai-agent-tool-descriptions-that-stop-wrong-tool-calls/)

Each description should answer five questions, including which tool to use instead. A three-tool customer support example, get_customer, search_orders and update_record, shows the rewrite, and a test of 40 real requests finds which pair of tools keeps getting swapped. - [how to write AI agent tool descriptions](https://startupfortune.com/how-to-write-ai-agent-tool-descriptions-that-stop-wrong-tool-calls/) - [prevent wrong AI agent tool calls](https://startupfortune.com/how-to-write-ai-agent-tool-descriptions-that-stop-wrong-tool-calls/)

For an agent you've built yourself, dump each server's tool list and count it. The MCP Inspector's command line mode does the first job. This command works for a remote server, and you add a --header flag if it needs a token. For a local server, replace the URL with the command that launches it.

```
mkdir -p dumpsnpx @modelcontextprotocol/inspector --cli https://example.com/mcp --method tools/list --format json > dumps/example.json
```

Save one file per server in that dumps folder. Then run this Python script with the Anthropic SDK installed and your API key set.

``` python
import json, glob, pathlib, anthropicclient = anthropic.Anthropic()MODEL = 'claude-sonnet-5-5'msg = [{'role': 'user', 'content': 'hi'}]def count(tools): r = client.messages.count_tokens(model=MODEL, messages=msg, tools=tools) return r.input_tokensbase = count([])every = []for path in sorted(glob.glob('dumps/*.json')): server = pathlib.Path(path).stem raw = json.load(open(path))['result']['tools'] tools = [{'name': (server + '__' + t['name']).replace('.', '_'), 'description': t.get('description', ''), 'input_schema': t['inputSchema']} for t in raw] print(server, len(tools), count(tools) - base) every += toolsprint('ALL', len(every), count(every) - base)
```

Token counting is free, subject to per-minute rate limits, and Anthropic calls the result an estimate. Requests with tools also carry a hidden tool-use system prompt, listed at 286 tokens for Sonnet 5.5 with automatic tool choice. Expect each server's line to include that overhead once, which makes the lines add up to a little more than the combined total.

Count on the model you ship with. Anthropic notes that the tokenizer used by Claude 4.7 and later produces about 30% more tokens than earlier ones, so an audit run on an old model, or a figure copied from a 2025 blog post, can understate your load today. The counting endpoint also rejects the API's mcp_servers parameter, which is why the script converts the dumped tools into ordinary definitions. Compare the result with the usage field on one real response. Check too that each dumped tool count matches what the server advertises, since MCP lets servers split the list across pages.

Your audit is worth sharing with the team once it records a few things for every server: tool count, definition tokens, how many of those tools appeared in your agent's logs over the past few weeks, who owns the integration, and the fix you've chosen. A server with 30 tools and two used ones is your first target.

## Cut the tools nobody calls

Pruning ranks first in the order of work even though other methods can post bigger percentages. It needs no new infrastructure, adds no search step, and removes wrong options from the model's view. The catch for your roadmap is that someone has to decide what the agent no longer does, and a rarely used tool may be the one you need during an outage.

GitHub's MCP server shows how much control you may already have. Its default toolsets are context, repos, issues, pull_requests and users. You can narrow them with the --toolsets flag or the GITHUB_TOOLSETS variable, name individual tools with --tools, and add --read-only to drop every write tool. The hosted version accepts X-MCP-Toolsets and X-MCP-Tools headers. Watch the first of those: GitHub's documentation says unknown toolset names are silently ignored, so rerun your count after changing it.

[How Does the Model Context Protocol Work, and What It Kills for Startups](https://startupfortune.com/how-does-the-model-context-protocol-work-and-what-it-kills-for-startups/)

How does the Model Context Protocol actually work, and why should founders care? MCP standardizes how AI agents connect to outside tools, and two years after Anthropic open-sourced it, that standardization is quietly commoditizing the AI integration startups whose whole pitch was doing that wiring for you. Here's the client-host-server mechanics... - [model context protocol for AI agent integration](https://startupfortune.com/how-does-the-model-context-protocol-work-and-what-it-kills-for-startups/) - [what happened to AI integration startup business models](https://startupfortune.com/how-does-the-model-context-protocol-work-and-what-it-kills-for-startups/)

Where a server offers no filter, filter on your side. Anthropic's MCP connector lets you set `enabled` to false as the default for a server and switch on only the tools you want. In Claude Code, you can toggle a whole server off in the /mcp panel without losing its configuration. Anthropic's cost guidance also notes that command line tools such as gh, aws and gcloud add no per-tool listing, which makes them a lighter choice when your agent already has a shell.

GitHub has published evidence from its own product. In a November 2025 post, engineers said they trimmed Copilot's default set in VS Code from about 40 built-in tools to 13 core ones and placed the others in grouped categories the model could open when needed. On benchmarks including SWE-Lancer and SWEbench-Verified, using GPT-5 and Sonnet 4.5, success rates rose by 2 to 5 percentage points. Online testing showed responses arriving 400 milliseconds sooner on average. Those were built-in tools, so don't expect identical numbers from your MCP stack. It's still a good reason to try a smaller default set.

## MCP tool search vs loading all tools

Deferred loading is the fix I'd reach for once you've pruned and still have a large catalog. You send the definitions with `defer_loading` set to true, and the model initially sees a search tool plus whatever you've kept loaded. When it needs something else, it searches and the matching definitions are added to the conversation.

Anthropic's own comparison, covering more than 50 MCP tools, went from about 77,000 tokens of context to about 8,700. The search tool took around 500 and the three to five tools it pulled in took about 3,000. On Anthropic's MCP evaluations, Opus 4 improved from 49% to 74% with tool search, and Opus 4.5 from 79.5% to 88.1%. Newer models have shipped since, so treat the accuracy gain as something to test on yours.

With the Messages API and the MCP connector, which is still in beta and needs its own beta header, the setting goes on the toolset. This fragment defers a whole GitHub server but keeps one frequent tool in view. You declare the server itself separately under mcp_servers.

```
"tools": [ {"type": "tool_search_tool_bm25_20251119", "name": "tool_search_tool_bm25"}, {"type": "mcp_toolset", "mcp_server_name": "github", "default_config": {"defer_loading": true}, "configs": {"issue_read": {"defer_loading": false}}}]
```

Keep your three to five busiest tools loaded, using your log counts to choose them. The API returns a 400 error if every tool is deferred, or if a deferred tool also carries a cache breakpoint. Search returns up to five matches by default and works from tool names, descriptions, argument names and argument descriptions. There's also a regex variant if your names follow a strict pattern.

Vague descriptions become a bigger problem here. A tool called `query` that says it queries data may never surface when someone asks about last week's error spike. Write the words your users would use into the description, and give the server clear instructions. Claude Code cuts server instructions and up-front descriptions at 4,096 characters in current versions, so put the important part first.

The price is an extra step before some calls. Anthropic says plain tool calling works better with fewer than 10 tools, when every tool gets used in every request, or when definitions are tiny. In Claude Code you can split the difference with `ENABLE_TOOL_SEARCH=auto`, which loads tools up front while they total under 10% of the context window, or mark one essential server with `alwaysLoad`.

OpenAI has the same idea in its Responses API for GPT-5.4 and later. It advises grouping tools into namespaces or MCP servers, ideally with fewer than 10 functions in each namespace. A deferred standalone function still shows the model its name and description, so you save mainly on the parameter schema unless you group.

## Code execution for the heaviest workloads

Anthropic's code execution pattern presents MCP tools as files of code. The agent browses them, reads the ones relevant to its task and writes a script that calls them. In the company's example, built around moving a meeting transcript from Google Drive into Salesforce, usage fell from 150,000 tokens to 2,000, a 98.7% cut. It's one worked example, so don't put that percentage in your forecast.

You also save on results, which for data-heavy agents can matter more. When data passes between tools inside code, the model needn't read it all. Anthropic estimates that a two-hour sales meeting transcript could add 50,000 tokens by traveling through the model twice, and it describes filtering a 10,000-row spreadsheet so the agent sees five rows.

Cloudflare took a related route on the server side. Its Code Mode server, described in February 2026, covers more than 2,500 API endpoints with two tools, search() and execute(), in around 1,000 tokens. The company calculated that a conventional server exposing the same API would need 1.17 million. You get that benefit only if a server is built this way or you build the layer yourself.

Somebody has to run that code. Anthropic says plainly that it needs a secure execution environment with sandboxing, resource limits and monitoring. Your agent is now writing programs against live systems, possibly with write access, and a bad loop can do more damage than a bad single call. I wouldn't take that on to save a few thousand tokens. It earns its keep when catalogs run to hundreds of tools or large results keep flooding the window.

## Caching lowers the bill and leaves the window full

Prompt caching belongs alongside whichever fix you choose. Tool definitions sit at the front of Claude's cached prefix, ahead of the system prompt and messages, and putting `cache_control` on the last tool in your array caches the set. With deferred tools in the mix, the breakpoint has to sit on one that stays loaded.

On Sonnet 5.5, base input costs $2 per million tokens, a five-minute cache write $2.50 per million and a cache read $0.10. Take a 55,000-token tool block across 20 requests: sending it uncached costs about $2.20, while one write followed by 19 timely reads costs about 24 cents. That's our arithmetic on list prices, covering the tool block alone.

The model's available space doesn't change. Anthropic's documentation states that cached prefixes still occupy the context window, and the model still has the same crowd of tools to choose from.

Caches are also easy to break. Changing a tool's name, description or parameters invalidates the whole thing, so avoid rebuilding the list differently on each turn. The current MCP specification says servers should return tools in a deterministic order, and it's worth testing that yours do. Deferred tools stay out of the cached prefix, so discovering one preserves it. For adding or removing tools partway through a conversation, Anthropic offers a beta on some newer models that records the change in a system message and leaves the original array alone.

## Which fix should you ship first?

On published savings for definitions, Anthropic's code execution example is the most dramatic and tool search comes next, though they weren't measured on the same setup. Pruning depends entirely on how much dead weight you carry, and caching saves money without saving space. Your order of work should differ from that leaderboard. Run the count today, compare each server's tokens with the tools you actually use, and switch off what nobody calls. If the remaining definitions still exceed about 10,000 tokens, a level at which Anthropic suggests tool search, defer the long tail and cache the stable part. Move to code execution when measurements show that definitions or intermediate results remain your main cost.

Then give the audit a pass or fail test. Pick 20 real tasks from your logs and record starting tokens, correct tool choices, total tokens and time to finish before and after each change. A smaller prompt that now misses the incident tool has made your agent worse, and running the tasks is how you'll catch it. Repeat the count whenever someone adds a server or upgrades the model.

**Also read:** [The ACH Return Rate Threshold for Unauthorized Returns Is Just 0.5%](https://startupfortune.com/the-ach-return-rate-threshold-for-unauthorized-returns-is-just-05/) • [How Many Times Can You Retry a Declined Card Payment Before Fees Hit?](https://startupfortune.com/how-many-times-can-you-retry-a-declined-card-payment-before-fees-hit/) • [How to Prevent Indirect Prompt Injection in AI Agents Before You Ship](https://startupfortune.com/how-to-prevent-indirect-prompt-injection-in-ai-agents-before-you-ship/)

*This article is posted in [AI News](https://startupfortune.com/category/ai/), check it out for more related stories.*

## Join the discussion

[Open in the community →](https://startupfortune.com/community/)

Almost there. Sign in and your reply posts straight away.
