MCP Tool Schemas Cost 8,038 Tokens
An agent with several MCP servers runs out of context early, and nobody can say how much of the window the tool schemas take.
📜 Table of Contents
📖 Keep reading
Four MCP servers, 37 tools, 8,038 tokens of JSON schema before the user types anything. That is the measured cost of the reference servers most coding agents mount: filesystem, memory, sequential-thinking and everything, spawned with npx on Node 22 and asked for their tools/list over stdio.
The number is not the point. The distribution is. One server with a single tool costs 1,003 tokens because its description runs 2,781 characters. On the same four servers, 62% of those schema tokens can be removed without touching a parameter name, a type, an enum value or a required field.
How the numbers were produced
- Node 22.22.0 on a 2 vCPU VPS, servers launched through npx with stdio transport.
- Handshake: initialize with protocolVersion 2025-06-18, then notifications/initialized, then tools/list.
- The raw tools array serialised with compact separators, which is what a client actually sends, counted with tiktoken o200k_base.
- Servers: @modelcontextprotocol/server-filesystem, server-memory, server-sequential-thinking, server-everything. The git server exited on startup in this environment and was excluded.
| Server | Tools | Schema tokens | Tokens per tool | First call latency |
|---|---|---|---|---|
| filesystem | 14 | 2,879 | 206 | 11.4 s (npx download) |
| memory | 9 | 2,448 | 272 | 2.0 s |
| sequential-thinking | 1 | 1,003 | 1,003 | 1.7 s |
| everything | 13 | 1,708 | 131 | 2.1 s |
| Total | 37 | 8,038 | 217 median |
For scale: 8,038 tokens is four percent of a 200k context window, spent before the system prompt, before any file contents, before the conversation. An agent with six servers and a hundred tools typically sits at 20,000 to 30,000 tokens of schema, which is where sessions start forgetting the beginning.
A single tool can cost more than a whole server
sequential-thinking ships one tool: 1,003 tokens. Its description is 2,781 characters of prose about when to use it, plus a JSON schema with five properties and per-property descriptions. The everything server, with thirteen tools, costs 1,708.
| Tool | Tokens | Tool description length |
|---|---|---|
| sequentialthinking | 1,003 | 2,781 chars |
| create_entities | 383 | 296 chars |
| search_nodes | 355 | 56 chars |
| open_nodes | 350 | 57 chars |
| read_media_file | 312 | 234 chars |
| read_text_file | 262 | 457 chars |
| edit_file | 261 | 185 chars |
| create_relations | 318 | 106 chars |
| add_observations | 295 | 142 chars |
| search_files | 229 | 424 chars |
Note the pattern: search_nodes at 355 tokens carries a 56-character description. Almost all of its cost is structural, the inputSchema object with typed properties, not prose. That matters for anyone planning to just shorten the descriptions.
Where the removals come from
Three transformations, each measured on the same four servers:
| Variant | Total tokens | Change |
|---|---|---|
| As served | 8,038 | - |
| Descriptions cut to first sentence, 120 chars max | 6,973 | -13% |
| title, $schema and annotations removed, property descriptions trimmed | 4,309 | -46% |
| Both | 3,020 | -62% |
Per server, both transformations together: filesystem 2,879 to 971 (-66%), memory 2,448 to 838 (-66%), sequential-thinking 1,003 to 288 (-71%), everything 1,708 to 923 (-46%).
The biggest single win is the title field every property carries. A property named path gets a title Path. The model already has the key. The same goes for the JSON Schema $schema URL and for annotation blocks carrying a readOnlyHint the model cannot act on.
Prose descriptions are the second win, and the cut has to be surgical. Read the complete contents of a file from the file system is enough. The remaining 400 characters about encodings, line ranges and offsets belong in the parameter descriptions, where they are read only when relevant, not in the tool description that is read on every turn.
What not to cut
- Enum values. The model chooses among them. Removing the list moves the failure to runtime.
- Required arrays. Dropping them lets the model omit the one argument the server rejects.
- Type unions and nested object shapes. A flattened schema produces invalid calls, and the retry costs more than the tokens saved.
- Parameter descriptions for anything non-obvious. The 80-character explanation of what line_offset means is the cheapest reliability available.
Which is why 62% is an upper bound, not a recipe. A realistic production trim on these four servers is the 46% row, roughly 3,700 tokens saved per turn with behaviour unchanged. How much is available depends on how much prose the vendor ships.
The two scripts
Probe any stdio server and dump its tools:
const { spawn } = require('child_process');
const p = spawn('npx', ['-y', '@modelcontextprotocol/server-filesystem', '/tmp'], { shell: true });
let buf = '';
p.stdout.on('data', d => {
buf += d;
let i;
while ((i = buf.indexOf('\n')) >= 0) {
const line = buf.slice(0, i); buf = buf.slice(i + 1);
if (!line.startsWith('{')) continue;
const msg = JSON.parse(line);
if (msg.id === 1) {
p.stdin.write(JSON.stringify({jsonrpc:'2.0',method:'notifications/initialized'}) + '\n');
p.stdin.write(JSON.stringify({jsonrpc:'2.0',id:2,method:'tools/list',params:{}}) + '\n');
}
if (msg.id === 2) { console.log(JSON.stringify(msg.result.tools)); p.kill(); }
}
});
p.stdin.write(JSON.stringify({jsonrpc:'2.0',id:1,method:'initialize',params:{protocolVersion:'2025-06-18',capabilities:{},clientInfo:{name:'probe',version:'1'}}}) + '\n');
Count what it costs:
import json, tiktoken
enc = tiktoken.get_encoding('o200k_base')
tools = json.load(open('tools.json'))
blob = json.dumps(tools, separators=(',', ':'), ensure_ascii=False)
print(len(enc.encode(blob)), 'tokens for', len(tools), 'tools')
Run that against a current config before adding another server. The number is the only way to answer whether the server is worth its context.
What it costs over a day
Schema tokens are sent on every request in a tool-calling loop. At one dollar per million input tokens, 8,038 tokens per turn is $8.04 per thousand turns; the trimmed version at 3,020 is $3.02. Prompt caching may bill the repeated prefix at a fraction, but the tokens still occupy the window, and window pressure is what degrades long sessions.
Practical rule: mount servers per task, not per installation. A filesystem server plus a database server covers most coding work under 4,000 tokens. Add sequential-thinking when the task is planning, then remove it.
FAQ
Is a bigger tool list really a problem? At 37 tools it is a four percent window tax. At 100 tools it is 20k tokens plus more near-duplicate names for the model to confuse.
Do all clients send the full schema every turn? The tool-calling clients checked here do, unless the provider caches the prefix. Caching cuts the price, not the window occupancy.
Can a server author trim descriptions safely? Yes: keep types, enums, required fields and parameter descriptions, cut tool-level prose to one sentence. Re-run the probe and compare counts before and after, keep the full version in a branch for debugging.
Related
- Remote MCP server auth - the 401 and PRM flow under the 2026-07-28 spec.
- Best MCP server hosting for solo developers - what the server side costs.
- Same 12 repos, 8 formats - the other half of the context bill.
Written by our editorial team; tools listed here are tested or verified against public sources. Links point to official sites or GitHub repos for reference only — no paid placements.