Context Budget Calculator for AI Agents
Add up what your agent puts in its context window before it reads the question: instructions, MCP tool definitions, retrieved chunks, memory, history and room for the answer. Then check whether that window still fits next to your model on your GPU. For anyone building agents on a local or hosted model.
Approximate, measured by Anthropic with Claude's tokenizer (Nov 2025). Your model's tokenizer will differ.
Your agent uses 12,700 of 32,768 tokens (38.8%) before the user's question.
| Part | Tokens | Share of window |
|---|---|---|
| Instructions | 1,500 | 4.6% |
| Tool definitions | 0 | 0% |
| Retrieved chunks | 3,200 | 9.8% |
| Memory | 1,000 | 3.1% |
| History | 3,000 | 9.2% |
| Output reserve | 4,000 | 12.2% |
| Free | 20,068 | 61.2% |
Does this window fit your GPU?
Five MCP servers in three context windows
| Window | Used before the question | Share | Verdict |
|---|---|---|---|
| 32K | 67,700 | 206.6% | does not fit (over by 34,932) |
| 128K | 67,700 | 51.7% | fits |
| 200K | 67,700 | 33.9% | fits |
How it works
Token sizes for the MCP servers are Anthropic's own measurements with Claude's tokenizer, so treat them as approximate: your model's tokenizer will count differently. Loading tools on demand is modelled as 500 tokens for a search tool plus 750 per tool it loads (our estimate from Anthropic's figures). Memory comes from the same compute module as every other page on this site.
- Pick the MCP servers your agent connects to, or a custom server with its tool count.
- Set the context window, the system prompt and how much retrieval, memory and history you keep.
- Turn on "load tools on demand" to see what tool search would save.
- Optionally pick a model and a GPU: the weights, KV cache and fit verdict come from the compute module.
Sources
- Anthropic: Introducing advanced tool use on the Claude Developer Platform (24 Nov 2025) — MCP server token counts, tool search
- Anthropic: Effective context engineering for AI agents (29 Sep 2025)
- LM Studio: MCP in LM Studio (0.3.17)
- Open WebUI docs: MCP support (v0.6.31+)
Checked 2026-11-28.
Questions
How many tokens do MCP tools use?
Each tool's name, description and input schema is sent to the model up front. Anthropic measured a five-server setup (GitHub, Slack, Sentry, Grafana, Splunk) at 58 tools and about 55,000 tokens before the conversation starts, and a Jira server alone at about 17,000. Those are Claude-tokenizer counts; local tokenizers differ.
What is a context budget?
The share of the context window each part of an agent's prompt takes: instructions, tool definitions, retrieved documents, memory, conversation history, and room left for the answer. With the five-server setup above and this tool's defaults, the agent needs 67,700 tokens before the question: 206.6% of a 32K window, so it does not fit.
Why does a bigger context window need more VRAM?
Every token in the window is held in the KV cache while the model generates. For Qwen3.8 27B with an f16 cache, our compute module gives 2.3 GB at 32K and 8.7 GB at 128K, on top of the weights. Fewer wasted tokens means a smaller window, which means less memory.
Does tool search work with local models?
Tool search is a pattern, not a Claude-only feature: give the model one search tool and load full tool definitions only when it asks. With four tools loaded per task, the five-server setup above would use about 3,500 tokens for tools instead of 55,000. Local hosts such as LM Studio (since 0.3.17) and Open WebUI (since 0.6.31) speak MCP; whether a host defers tool definitions depends on the host and router you use.