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 (14)

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 •

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?