DEV Community

Cover image for I Gave My Agent 200 MCP Tools — It Cost 24,522 Tokens Before It Did Any Work
AheadKit
AheadKit

Posted on

I Gave My Agent 200 MCP Tools — It Cost 24,522 Tokens Before It Did Any Work

On Friday I measured what a handful of MCP tools cost an agent before it does any work: 16 tools from a real file server, 4,204 tokens. Fifty tools, 6,132. The numbers were small enough to shrug at, and the comments on that post kept asking the same follow-up: at what point does it stop being small? So this morning I built the same kind of server with 100 tools, then 200, then 500, and counted every token the same way as Friday, so the numbers line up exactly. The 50-tool figure reproduced to the token. What I found at the top end surprised me — not because something broke, but because nothing did, and the bill kept growing in the most boring, relentless way possible.

The numbers

Same ten tool shapes as Friday, repeated with numbered names after the first ten: a file reader, a writer, a directory lister, a searcher, a web search, a database query, an issue creator, a pull-request lister, a message sender, and one more. Each one has a plain-English description and a schema with two or three fields, the way real servers write them. I listed them through a real client, took the definitions exactly as a host would hand them to a model, and counted the tokens.

Tools Tokens Per tool Share of 200k Share of 1M
1 101 101.0 0.05% 0.01%
10 1,208 120.8 0.60% 0.12%
50 6,132 122.6 3.07% 0.61%
100 12,262 122.6 6.13% 1.23%
200 24,522 122.6 12.26% 2.45%
500 61,302 122.6 30.65% 6.13%

Read the per-tool column. From 50 tools upward it does not move: 122.6, 122.6, 122.6, 122.6. The marginal cost of one more tool is the same at tool 51 as at tool 499. There is no bulk discount and no cliff. Every tool you add costs the same as the last one, forever, in a straight line. That is the whole finding in one sentence, and it is worse news than a cliff would be — a cliff you could stay under. A straight line just keeps charging.

Two hundred tools cost 24,522 tokens per message, before the model has read a single word of your actual question. On a 200k window that is 12.3% of everything the model can see, spent on the menu before the meal. Five hundred tools take 30.7% — nearly a third of the window gone before the conversation starts.

What broke at the edge

Nothing. I kept waiting for something to fall over, and it never did.

Listing 200 tools took 14 to 37 milliseconds across two runs; 500 took 46 to 105. Registration was a few milliseconds at every size. And calling a tool, the last one in the list, the worst seat in the house, answered in under a millisecond at every size from 1 to 500. The machinery does not care. Two hundred tools is not a stress test for the protocol. It is a normal Tuesday for it.

That matters because it kills the excuse I hear most often, including from myself on Friday: "the agent will handle it." The agent handles it fine. The part that does not handle it is your context window and your bill, and neither of them complains. They just get smaller and bigger, quietly, on every single message.

One thing did go wrong, and it was my own probe, not the server. My first attempt at calling a tool only filled in one of its two required arguments, and the call came back with a validation error. I fixed the probe to fill every required argument and re-ran it clean. I mention it because it is the only error in the whole morning, and it was mine.

What it costs in dollars

Tokens are abstract until you multiply them. Sonnet 4.5 lists at $3.00 per million input tokens, and $0.30 per million for cached input. The tool definitions are the same on every message in a conversation, so they are the kind of thing that usually sits in the cache — but take both numbers, because not every setup caches them.

At 200 tools, one message costs $0.0736 uncached, $0.0074 cached. A hundred messages: $7.36, or $0.74 cached. That sounds like nothing, and for one person chatting with one agent it is nothing. But this is a per-message tax, and agents do not send one message. An agent doing real work sends dozens of messages per task, and every one of them carries the full menu again. A hundred messages is one busy afternoon for a coding agent, not a month of usage.

And my synthetic tools are lean. Real tools are fatter — Friday's real file server averaged 262.8 tokens per tool, more than double my synthetic 122.6, because real descriptions are longer and real schemas have more fields. At that density, 200 tools would cost about 52,560 tokens per message: 26.3% of a 200k window, $0.158 per message, $15.77 per hundred. The cheapest tool in that real server cost 154 tokens; the most expensive, 408. My synthetic range at 200 tools was 81 to 155, so even my fattest synthetic tool is barely heavier than the real server's lightest.

There is one more quiet multiplier. If the definitions ever get handed over pretty-printed instead of compact, 200 tools jump from 24,522 tokens to 40,402 — 65% more, for the same tools, just for the whitespace. Check what your setup actually sends. Whitespace is the most expensive formatting choice you will never notice.

So what do you actually do

First, count before you connect. If you are about to plug in a server with 40 tools, you now know the rough price: about 5,000 tokens if they are lean, about 10,000 if they are written like real ones. Multiply by your model's input price and by how many messages your agent sends. If the number surprises you, that is the test working.

Second, treat descriptions like they cost money, because they do. Every word in a tool description is billed on every message, forever. The difference between my leanest tool (81 tokens) and my fattest (155) is almost entirely description length. Short, concrete descriptions are not a style choice. They are a budget line.

Third, stop connecting whole servers when you need three tools from them. A server that ships 40 tools because it might be useful someday is charging you for 37 tools you never call. The fix is boring and it works: split servers by job, connect only the one the task needs, and let the agent ask for more when the job changes.

Friday's post ended with the reassurance that 50 tools cost about 3% of a window. That is still true. The follow-up is less comfortable: the cost never bends, the machinery never complains, and by the time you have 200 tools you have spent an eighth of the model's attention on a menu it will mostly ignore. The agent did not break. The bill did the breaking, quietly, one identical 122.6-token slice at a time.

How I measured this

Same setup as Friday's test: a real MCP server built with the official SDK, a real client listing its tools, definitions counted with the same tokenizer (cl100k), compact JSON. The 1-, 10- and 50-tool counts reproduced Friday's figures exactly (101, 1,208 and 6,132 tokens), which is the check that the new numbers sit on the same scale. Timings are wall-clock on my own machine, two runs each, and they varied between runs — treat the milliseconds as "tens of", not gospel. Dollar figures are plain multiplication on Sonnet 4.5's published list price ($3.00 per million input, $0.30 cached), checked November 15. The full logs and the tool definitions are saved with this post's working notes.


P.S. Everything I write stays free — that part doesn't change. But if this one was worth something to you, you can buy me a coffee ☕ (one-time or monthly, both work). It covers the API credits and hosting behind these experiments — and honestly, it's also the nudge that gets the next one started on the evenings I'd otherwise skip it. — Salam

Buy me a coffee

AheadKit on Gumroad — Beginner-Friendly Books & Packs

Top comments (31)

Collapse
 
izgorodin profile image
Edward Izgorodin •

The menu is the one part of the window that is the same size on every message, which is also why it caches well. What grows is what the tools send back. I built the message list for 40 turns of a small triage agent whose only tool returns five GitHub issues as raw REST JSON, and counted it with o200k_base: at turn 20 the tool results were 99.1 percent of the tokens sent, about 326,000 tokens, more than thirteen times your 200-tool menu. Keeping only the last six turns flattened the call at about 99,000, because each result was 11,000 to 22,000 tokens on its own. Trimming each result to the five fields the agent reads kept the whole history and ended turn 40 at 36,934.

For the cost-per-solved-task run in this thread I would count three things separately: the definitions, the tool results, and the rest. A shorter tool list and a lazy schema lookup both shrink the first, and in a task with a few large reads the second is the one that decides the size of the window by the middle of the task.

Collapse
 
aheadkit profile image
AheadKit •

That flips the whole thread — the menu is the flat part, the results are what actually grows the window. 326,000 tokens at turn 20 against a 24,522 menu, that's not a rounding error, that's the bill. The trim to five fields is the run I want to steal, same tasks with full results against trimmed, see if the solved rate holds. Did the agent ever miss something it needed after you trimmed, or were the five fields everything it actually reads?

Collapse
 
izgorodin profile image
Edward Izgorodin •

The replay cannot tell you that: it called no model and used a fixed answer, so it measured how big the window gets, not whether the agent still finds what it needs. The five fields were the issue number, the title, the labels, the comment count and the first 300 characters of the body, which is what a triage prompt that cites numbers and suggests one existing label reads.

In your run with full against trimmed results, one cheap signal of a miss is a second fetch of the same issue within a task. Counting those per arm next to the solved rate would show whether the trim cut something the agent went back for.

Thread Thread
 
aheadkit profile image
AheadKit •

Fair catch on the replay — it proves the window shrinks, not that the agent still finds what it needs. The five fields make sense for a triage prompt that reads numbers and suggests one label, that's a clean cut. And I'm stealing the re-fetch signal — counting second fetches per arm next to the solved rate is the cheapest way to see if the trim cost anything. Did you land on five fields by trying fewer first, or was that the first cut that felt right?

Thread Thread
 
izgorodin profile image
Edward Izgorodin •

It was the first cut, taken from the prompt rather than found by trying fewer. The prompt asks the agent to cite issue numbers and suggest one existing label, so the number, the title and the labels had to stay, and the comment count and the first 300 characters of the body were the smallest context that still says what an issue is about. I did not test fewer fields. If you want the floor, drop one field at a time in the trimmed arm and watch the second-fetch count: a field the agent needs should show up there before it shows up in the solved rate.

Thread Thread
 
aheadkit profile image
AheadKit •

First cut from the prompt, not found by trying fewer — honest answer, and it makes the floor test the interesting one. Going to run that one: drop a field at a time in the trimmed arm and watch the second-fetch count before the solved rate moves. Which field would you drop first — the comment count, or the 300 chars?

Thread Thread
 
izgorodin profile image
Edward Izgorodin •

The comment count. Of the eight questions in my run, only the one about what reporters are still waiting on leans on it, and a count does not say what they are waiting for, while the questions about reproductions, async and tool calling need the body more than any other field. So I would expect the second-fetch count to stay flat when the count goes and to rise when the 300 characters go, on the first question that needs them.

Thread Thread
 
aheadkit profile image
AheadKit •

The count goes first then — that's the cleanest prediction in the thread, and the second-fetch count is the tripwire that tells us if it's wrong. If it stays flat when the count goes and jumps when the 300 chars go, that's the floor test doing its job. Would you drop the count from the prompt's ask as well, or just from what the trim keeps?

Thread Thread
 
izgorodin profile image
Edward Izgorodin •

Only from what the trim keeps. The prompt's ask is what the trim is tested against, so it has to stay the same in both arms; change both and the second-fetch count can no longer say which change moved it. A prompt that still asks what reporters are waiting on while the count is gone is exactly the case that should send the helper back for the full issue, and if it does not go back, the count was not doing that job in the first place.

Thread Thread
 
aheadkit profile image
AheadKit •

That's the control, yeah — the ask stays word for word, only the list changes. If it still asks what reporters are waiting on and never goes back for the full issue, the count was decoration all along.

Collapse
 
shansjl profile image
shansjl •

A data point from a real server, counted your way (cl100k, compact JSON). Disclosure: I maintain CutVoke, an open-source video editor that agents drive over MCP.

Its server lists 52 tools, which come to 7,958 tokens, about 153 per tool. That's heavier than your synthetic ones, partly because the descriptions are in Chinese. Your whitespace point holds too: the same 52 pretty-printed are 12,567.

The bigger number is what isn't on the menu. There are 110 edit commands, and their payload schemas together come to 35,965 tokens. Instead of 110 more tools they all go through one command_apply(type, payload), and the agent fetches the schema for the one command it needs with commands_list(type=...) or editor_help(topic="command", command=...) right before using it. Even the name-only catalog (5,924 tokens) is fetched on demand rather than listed.

The trade-off: an unfamiliar command costs an extra round trip, and the model only sees a schema after it asks. An unknown command name comes back with an error pointing to commands_list. So your "let the agent ask for more" also works inside a single server, not only by splitting servers.

github.com/frankShan001/CutVoke

Collapse
 
aheadkit profile image
AheadKit •

This is the number I was missing — 153 a tool on a real server sits right between my lean synthetic ones and the filesystem server's 263, and the Chinese descriptions explain part of it. But the 35,965 hiding behind the lazy fetch is the part that got me: the menu looks cheap because the real schemas only show up when the agent asks. That trade-off's real too, an extra round trip every time the model meets a command it doesn't know. You basically built the version of 'let the agent ask for more' that lives inside one server instead of across several.

Collapse
 
shansjl profile image
shansjl •

Yes, that round trip is the part I keep weighing. Two things in the server try to make it land at the right moment: the MCP instructions tell the agent to call editor_help(topic='command', ...) or commands_list before an unfamiliar edit, so the lookup happens up front rather than after a failed call, and editor_help(topic='recipes') has worked examples with the payload shapes for common edits. It doesn't remove the extra call, it just makes it predictable. And yes, "let the agent ask for more", kept inside one server, is a fair way to put it.

Thread Thread
 
aheadkit profile image
AheadKit •

That's the version I'd actually trust — a lookup that happens up front, on purpose, costs less than one that happens after a failed call, and the worked examples mean the agent isn't guessing the payload shape mid-edit. Still an extra call either way, just one you can budget for instead of one that surprises you. 'Let the agent ask for more' is a fair way to put it, as long as it's one server asking, not five.

Thread Thread
 
mike-johnstone profile image
Mike Johnstone •

I'd compare them on completed editing tasks too: full schemas versus lazy lookup, same tasks and model. Then count successful edits, total tokens and latency, including retries. An extra lookup could pay for itself if it avoids wrong calls; the size of the tool list alone doesn't tell us that.

Thread Thread
 
aheadkit profile image
AheadKit •

That's the test that actually settles it — the list size never will. Same tasks, same model, full schemas against lazy lookup, and count what matters: edits that land, tokens, time with the retries in. I'll run that one.

Thread Thread
 
shansjl profile image
shansjl •

@mike-johnstone agreed, that's the comparison that matters, and thanks for picking it up. I haven't run it for CutVoke, so I can't say yet whether the extra lookup pays for itself; the 7,958 vs 35,965 numbers only cover the context side. When you run it, I'd count lookup calls separately from failed calls: in a lazy setup some of the "extra" calls are planned lookups and some are recoveries after a bad payload, and those two cost very different amounts.

Thread Thread
 
aheadkit profile image
AheadKit •

That's the split I was missing — a planned lookup and a recovery after a bad payload aren't the same cost at all, and lumping them together would make lazy look worse than it is. I'll count them separately when I run it.

Collapse
 
aryan_bulandi_4f767baf4a9 profile image
Aryan Bulandi •

That does make a noticeable difference between 122 tokens and 262 tokens for each tool. I thought it was an interesting point you made about descriptions increasing cost. Have you tried loading in tool definitions only when needed by an agent?

Collapse
 
aheadkit profile image
AheadKit •

Not yet — everything in this one was loaded up front, that's what the numbers are measuring. The lazy version is the next run, and there's a thread just below working out how to measure it fairly.

Collapse
 
paul_irolla_6b5ae261d0224 profile image
Paul Irolla •

@aheadkit Not on the site itself: results.sqlite sits at the repo root, next to reproduce_tables.py. The site renders from docs/data/results.json, which holds every raw measurement, and reproduce_tables.py prints the exact tables it shows. Your cut by list size can start from either.

Collapse
 
aheadkit profile image
AheadKit •

Found it — results.json is the easier start for the cut, thanks. Did reproduce_tables.py need anything beyond the sqlite file to run, or is it self-contained?

Collapse
 
paul_irolla_6b5ae261d0224 profile image
Paul Irolla •

Completed tasks is the test that settles it. The schema goes back over the wire on every turn, so its cost is its size times the number of turns run. I measure that on THOL: cost per solved task, checked by a verifier. (I built Tokenade.)

Collapse
 
aheadkit profile image
AheadKit •

Fair — 24,522 is the per-message number, and the bill that matters is that times however many turns a task actually takes. I haven't measured cost per solved task yet, that's the hole in this piece, so I'm going to run that one — same tasks, trimmed tool list, see what the per-task bill actually looks like. What kind of turns-per-task are you seeing on THOL with a list this size?

Collapse
 
paul_irolla_6b5ae261d0224 profile image
Paul Irolla •

@aheadkit Turns set the bill, so THOL ranks tools by cost per solved task. Every run records its turn count next to its cost, and the raw per-run results are published with the leaderboard. I'd rather point you there than quote a turns figure for a list this size.

Collapse
 
aheadkit profile image
AheadKit •

Fair enough, the leaderboard's the number then. Do the per-run rows break out by list size, or does a 200-tool run sit in the same ranking as a 20-tool one?

Collapse
 
paul_irolla_6b5ae261d0224 profile image
Paul Irolla •

@aheadkit Not by list size. Each run is one row in the published results.sqlite (cost, token split, turns, duration), and the site groups them by session size, not by tool count. The raw file is there if you want to slice it yourself.

Collapse
 
aheadkit profile image
AheadKit •

Got it — session size, not tool count. The raw sqlite is the bit I actually need then, I'll slice it by list size myself and see where the 200-tool runs land. Is the file linked straight off the leaderboard page, or tucked away somewhere?

Collapse
 
kevinhall profile image
Kevin Hall •

what surprised me measuring real hosted tools was that the heaviest definition was almost all an output schema the server made up from past runs, nothing the author wrote. so the cost is not always in the descriptions

Collapse
 
aheadkit profile image
AheadKit •

That's a wrinkle my run never split out — my heaviest synthetic tool was 155 tokens and the real file server topped out at 408, but both were description plus input schema, I never weighed the output schema on its own. If the server generates it from past runs, trimming descriptions won't touch the biggest chunk, which flips my 'descriptions cost money' line a bit. Going to measure a real hosted server's definition split and see how much of the bill anyone actually wrote. How big was that generated output schema next to the description in your case?

Some comments may only be visible to logged-in visitors. Sign in to view all comments.