MCP Tool Schemas Cost 8,038 Tokens

🔧 AI Tools 2026-11-27 6 min read

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

ServerToolsSchema tokensTokens per toolFirst call latency
filesystem142,87920611.4 s (npx download)
memory92,4482722.0 s
sequential-thinking11,0031,0031.7 s
everything131,7081312.1 s
Total378,038217 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.

ToolTokensTool description length
sequentialthinking1,0032,781 chars
create_entities383296 chars
search_nodes35556 chars
open_nodes35057 chars
read_media_file312234 chars
read_text_file262457 chars
edit_file261185 chars
create_relations318106 chars
add_observations295142 chars
search_files229424 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:

VariantTotal tokensChange
As served8,038-
Descriptions cut to first sentence, 120 chars max6,973-13%
title, $schema and annotations removed, property descriptions trimmed4,309-46%
Both3,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

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

Related Articles
2026-08-20
Best AI Game Art Generator in Chengdu 2026: 6 Tools for Game Studios
2026-07-04
llama.app Goes Live: llama.cpp Finally Has a Home
2026-08-24
Best AI Resume Builder in Detroit 2026: 6 Tools for Auto Industry Job Seekers
2026-08-20
Best AI Product Photo Generator for Wholesale in Guangzhou 2026: 6 Tools for E-commerce Exporters
2026-11-15
AI Test Maker in Chinese: 3 of 120 Wrong Options Are Unverifiable
2026-07-11
OpenClaw 5.28: Security Fences Bolted Shut, Video Generation Built Right In

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.

💬 Comments (0)

No comments yet. Be the first!

Login to comment