DEV Community

Sarvar Nadaf Subscriber for AWS Community Builders

Posted on AI-assisted

MCP Token Cost: I Cut My MCP Server From 15 Tools to 4

Includes full GitHub code and video demo

Here is a number that should bother you. GitHub's official MCP server loads about 55,000 tokens across 93 tool definitions before you ask it a single question. On a 200K context window that is more than a quarter of your budget, spent, before the agent does any work.

I did not believe it until I measured my own. So I built a small AWS MCP server the way most people build them, wired it into Kiro, and asked it one question: "where am I wasting money in this account?" It took seven tool calls to answer. Then I rebuilt the exact same server following AWS's own tool-design playbook. Same account, same question. Two tool calls. Fifteen tools became four. The tool schemas shrank by 88%.

This is the story of that rebuild, with the numbers on screen. It is a practical look at MCP token cost: where it comes from, how to measure it, and how to cut it. Not a hello-world server with an add_numbers tool. A read-only AWS cost-triage server that finds genuine wasted spend, shipped in two versions in the same repo.

The full code is on GitHub, both servers in one place so you can diff them:

GitHub logo simplynadaf / aws-lean-mcp

A read-only AWS cost-triage MCP server, shipped bloated (15 tools) and lean (4 tools), to demonstrate MCP tool design and cut token cost. Same account, same question: 7 tool calls down to 2.

πŸͺΆ aws-lean-mcp

The same AWS MCP server, built twice (bloated, 15 tools, and lean, 4 tools), so you can watch your AI agent get cheaper and smarter, live, in Kiro's /context view.

Kiro Crew AWS MCP Read Only License: MIT

Stars Forks Issues


⭐ If this helped you design better MCP tools, give it a star! It helps others find it.

Video Tutorial β€’ The Problem β€’ The Scoreboard β€’ Getting Started β€’ The 4 Fixes β€’ Contributing


🎬 Video Tutorial

Watch the full rebuild, from a bloated 15-tool server that makes the agent flail, to a lean 4-tool server that answers in one clean call:

πŸŽ₯ Watch on YouTube (link goes live with the episode)

In the video you'll see:

  • Why a typical MCP server quietly eats your context window before you ask a single question
  • The two failure modes AWS named: bloat and confusion
  • The bloated server making the agent take 7 tool calls to answer one question
  • The…

Who this is for

You have wired up a few MCP servers in Kiro, Claude Code, or Cursor. Maybe you built one. It worked in the demo, and then your agent started feeling slower, dumber, and more expensive as you added tools. You have seen the phrase "context bloat" and want to know if it is real, how bad it is, and what to do about it.

If you can read a Python function and a JSON file, you can follow this.

Table of contents

  1. The two ways an MCP server rots your agent
  2. The anti-pattern, on purpose (v1: 15 tools)
  3. The rebuild, fix by fix (v2: 4 tools)
  4. The scoreboard: what changed
  5. The honest part about the context meter
  6. Even AWS keeps its tool list tiny
  7. Try it yourself
  8. What the blog posts do not tell you

1. The two ways an MCP server rots your agent

AWS published the clearest breakdown of this in July 2026, in a post called MCP tool design: Practical approaches and tradeoffs. It names two failure modes, and they feed each other.

Bloat. Every tool definition loads into the context window on every call, whether the model uses it or not. Each tool schema runs 550 to 1,400 tokens, so fifty tools can mean 30,000 to 70,000 tokens of definitions before any work starts. A typical Claude Code session with five to ten MCP servers installed burns 50,000 to 67,000 tokens before you type your first prompt. You pay that tax on every turn.

Confusion. As the context fills up and your tools start looking alike (describe_volumes, describe_addresses, describe_snapshots, all thin, all similar), the model picks the wrong one, passes the wrong parameters, gets an empty result, and retries. Each retry adds more tokens. Bloat causes confusion, confusion causes more bloat. A spiral.

The root cause of both is the most common way people build MCP servers: take an API, wrap each endpoint as its own tool, ship 30 of them. It feels complete. It is a trap.


2. The anti-pattern, on purpose (v1: 15 tools)

To fix something you need something broken. So server_v1_bloated.py is built the way most servers really ship. Fifteen tools, each a thin 1:1 wrapper over one boto3 call.

@mcp.tool()
def describe_volumes() -> dict:
    """Describe Amazon EBS volumes in the account for the configured region.

    This tool calls the EC2 DescribeVolumes API and returns the complete
    response payload for every EBS volume it can see. Use this tool when you
    need to inspect block storage devices, their attachment state, size in
    GiB, volume type (gp2, gp3, io1, io2, st1, sc1, standard), encryption
    status, IOPS, throughput, the Availability Zone, creation timestamp, and
    the list of tags. A volume whose State field is 'available' is not
    attached to any instance and may be wasted spend...
    """
    return ec2.describe_volumes(Filters=_DEMO_FILTER)
πŸ”΄ Live TV: aws builders/mcp token cost i cut my mcp server from tools to cek - Jadwal Siaran Langsung πŸ”΄ Live TV: aws builders/mcp token cost i cut my mcp server from tools to cek - Jadwal Siaran Langsung

That docstring is trimmed here for print. In the repo it is longer, and that is the point. Notice three problems baked in:

  • The docstring is long, and it loads into context every single call, used or not.
  • It returns the full 40-field boto3 blob. That is response bloat: the agent gets fifteen fields it will never read.
  • To answer "where am I wasting money?" the agent has to know to call describe_volumes, then describe_addresses, then describe_snapshots, then check load balancers, then correlate all of it itself.

When I asked the bloated server my question in Kiro, it made seven waste-server tool calls: get_caller_identity, describe_volumes, describe_addresses, describe_snapshots, describe_instances, describe_nat_gateways, describe_load_balancers. It fished around, one call at a time, then assembled the answer. It got there. It was not pretty.


3. The rebuild, fix by fix (v2: 4 tools)

server_v2_lean.py has the exact same capability. Same read-only checks, same account, same findings. It applies AWS's ladder, and each rung is one clear fix.

Fix 1: outcome-level tools. Instead of fifteen thin wrappers, four tools that each complete a whole business action. The headline one:

@mcp.tool()
def find_waste(scope: Literal["account", "region", "service"] = "account",
               detail: bool = False) -> dict:
    """Find wasted AWS spend in one call. Returns each finding with 5 decision
    fields (id, kind, size/ip, why, region). Set detail=True for the full blob.
    """
πŸ”΄ Live TV: aws builders/mcp token cost i cut my mcp server from tools to cek - Jadwal Siaran Langsung πŸ”΄ Live TV: aws builders/mcp token cost i cut my mcp server from tools to cek - Jadwal Siaran Langsung

"Where am I wasting money?" is now one call, not seven. The tool runs all the checks internally and returns findings.

Fix 2: schema constraints. The scope parameter is a Literal["account", "region", "service"], not free text. The model cannot pass a garbage value, and it does not have to guess. AWS Prescriptive Guidance recommends keeping tools to around eight parameters or fewer. Every tool here has two.

Fix 3: lean responses. By default find_waste returns five decision-relevant fields per finding, not the full blob. If the agent genuinely needs everything, it passes detail=True. Anthropic's own guidance on code execution with MCP makes the same point: filter and shrink tool results before they reach the model, so the agent reads five rows instead of ten thousand.

if not detail:
    keep = ("id", "kind", "size_gib", "public_ip", "why", "region", "source_volume")
    findings = [{k: v for k, v in f.items() if k in keep} for f in findings]
πŸ”΄ Live TV: aws builders/mcp token cost i cut my mcp server from tools to cek - Jadwal Siaran Langsung πŸ”΄ Live TV: aws builders/mcp token cost i cut my mcp server from tools to cek - Jadwal Siaran Langsung

Fix 4: lazy taxonomy. Instead of baking every valid value into every tool description, there is a small describe_scope() tool the agent calls only when it needs to confirm inputs. Anthropic's Tool Search approach reports up to 85% token reduction by loading definitions only when relevant.

Fix 5: real errors. A bad scope returns "scope must be one of: account, region, service", not "no results". The model can recover from the first. The second sends it into a retry loop.

When I asked the lean server the same question, it called find_waste once, then estimate_savings to price it. Two calls. Clean.


4. The scoreboard: what changed

Same read-only agent. Same question. Same real AWS account in us-east-1. Every number here came from an actual run, filmed live.

Metric v1 bloated v2 lean Delta
Tools exposed 15 4 -73%
Tool-description size (chars, proxy for schema tokens) 7,898 897 -88%
Tool calls to answer the question 7 2 -71%
Real findings cited 3 IDs same 3 identical
Dollars from real Price List API yes yes identical
Attempted any mutation? no no read-only held

Both versions found the same wasted spend and cited the same resource IDs:

  • vol-0c85bd44ef6f9c19d, an unattached 8 GiB gp2 volume, about $0.80 a month.
  • snap-0e8e4ff717cead51e, an orphaned 8 GiB snapshot, about $0.40 a month.
  • eipalloc-000992c9956cfaaa5, an unassociated Elastic IP. The agent could not get a verified rate from the pricing tool, so it labeled the impact "not verified" rather than guessing. I built that honest refusal in on purpose.

One outcome-level tool did the work that took the bloated server seven separate guess-and-fish calls.

A quick note on what those schema chars cost in dollars. The 7,898 characters of v1 definitions are roughly 2,000 input tokens, loaded on every single turn. The lean 897 characters are about 225. On Claude Sonnet at $3 per million input tokens, that gap is tiny per call, a fraction of a cent. The reason it matters is that it multiplies: by every turn, every agent, every developer, and by the 90-plus tools a production setup runs instead of 15. A rounding error at demo scale becomes a line item at team scale.


5. The honest part about the context meter

Here is where I have to be straight with you, because most posts on this topic are not.

On my small demo, Kiro's /context tool budget only moved from 1.1% to 0.8%. True, but small. Fifteen tiny tools are still tiny against a 200K window, and the shared pricing server dominates the budget in both agents anyway.

So I am not going to put a dramatic "72% down to 8%" meter on screen and pretend it is my demo. The dramatic, filmed-live numbers are the ones in the table: 7 calls to 2, 15 tools to 4, 88% smaller schemas.

The big context figures (the 55,000-token GitHub server, the "72% of context consumed before the agent takes a single action") hold up, but they are industry data at production scale, clearly labeled as such. The point is the direction: a design principle that saves 0.3% on 15 tools saves 20% or more on the 90-plus tools a production setup runs. You do not want to discover that at scale.


6. Even AWS keeps its tool list tiny

The strongest proof is not mine. AWS's own managed AWS MCP Server exposes about eight tools for all of AWS, and in July 2026 it deprecated its call_aws tool in favor of a single run_script tool, shrinking the surface further. Its docs say, in plain words: "avoid referring to specific tool names in prompts, let your agent select the appropriate tool."

Lean, outcome-level surfaces plus on-demand context is not a hack I invented. It is how AWS builds its flagship server. This repo just lets you prove it on your own.


7. Try it yourself

Everything is in the repo, both servers side by side.

git clone https://github.com/simplynadaf/aws-lean-mcp.git
cd aws-lean-mcp
πŸ”΄ Live TV: aws builders/mcp token cost i cut my mcp server from tools to cek - Jadwal Siaran Langsung πŸ”΄ Live TV: aws builders/mcp token cost i cut my mcp server from tools to cek - Jadwal Siaran Langsung

Prove the difference without an agent at all:

python3 scripts/smoke_test.py
# 15 -> 4 tools, 897 vs 7898 description chars (88% fewer), real IDs from both servers
πŸ”΄ Live TV: aws builders/mcp token cost i cut my mcp server from tools to cek - Jadwal Siaran Langsung πŸ”΄ Live TV: aws builders/mcp token cost i cut my mcp server from tools to cek - Jadwal Siaran Langsung

Then wire each into Kiro and run the A/B with the same prompt in both. The agent JSONs and read-only IAM guidance are in the repo. It is read-only end to end: the servers only call Describe, Get, and List. There is no write action in the code.

If you want findings to triage, scripts/create-demo-resources.sh creates a few cheap, clearly tagged, intentionally wasteful resources, and the teardown script removes 100% of them.


8. What the blog posts do not tell you

Three things I only learned by building it.

The docstring is the schema. With FastMCP, your Python docstring and type hints become the tool definition the model sees. So you make the bloat-versus-lean call at the code level, every time you write a tool. A three-paragraph docstring is three paragraphs loaded on every call.

Splitting a tool can make the schema smaller, not bigger. It feels backwards. But moving valid values out of a fat description and into a separate describe_scope() tool that loads on demand shrinks what gets sent every turn. Fewer always-loaded tokens, at the cost of one extra round-trip when the info is genuinely needed.

Response bloat is half the problem and nobody talks about it. Everyone counts tool definitions. Almost nobody counts the fat JSON your tools return. Returning five fields by default instead of fifty is the cheapest win available, and it compounds on every call.

You did not need more MCP servers. You needed to build the one you have correctly.

Now I am curious about yours. Open the MCP server you use most and count the tools it exposes. Drop that one number in the comments: is it under 10, or did it creep past 30? And if you have ever measured the token cost before your first prompt, tell me what you saw. I will reply to every number.


Follow me for more on AWS architecture, DevOps, and AI Infrastructure:
Portfolio | LinkedIn | Dev.to | YouTube | Email | AWS Builder Center | X

Top comments (118)

πŸ”΄ Live TV: aws builders/mcp token cost i cut my mcp server from tools to cek - Jadwal Siaran Langsung
 
sinarezaei profile image
Sina Rezaei •

One edge case I'd test is partial failure across regions. Say find_waste(scope="account") scans EBS volumes, snapshots, and NAT gateways across several regions, but DescribeSnapshots gets throttled in eu-west-1 after a few pages. If the tool returns the findings it collected without making that gap explicit, the agent could report an incomplete cost audit as if it had checked the whole account.

I'd include a compact scan status per service and region, with pagination completion and failed checks, alongside the findings. That keeps the default payload lean without confusing "nothing found" with "not fully checked." Fewer tool calls are great, but the aggregated result still needs to tell the agent what it couldn't verify.

πŸ”΄ Live TV: aws builders/mcp token cost i cut my mcp server from tools to cek - Jadwal Siaran Langsung
 
sarvar_04 profile image
Sarvar Nadaf AWS Community Builders •

this is the exact hole in v2, and your throttle example is where it bites hardest, find_waste(scope="account") fans out across regions and if DescribeSnapshots gets throttled in eu-west-1 after a few pages, right now it either fails the whole call or, worse, returns what it got as if it were complete. a compact scan status per service and region, with pagination completion and failed checks alongside the findings, is the fix, and it keeps the default lean because the status is small. the key line you wrote is not confusing "nothing found" with "not fully checked", that's the one that makes an incomplete cost audit dangerous instead of just incomplete. going into the next version.

πŸ”΄ Live TV: aws builders/mcp token cost i cut my mcp server from tools to cek - Jadwal Siaran Langsung
 
sinarezaei profile image
Sina Rezaei •

Nice, that's exactly the distinction I was concerned about. One thing I'd consider adding is whether a scan can be resumed without starting the entire account audit again.

For example, imagine scanning 40 AWS regions across several services. Most regions complete successfully, but a throttling event interrupts DescribeSnapshots halfway through pagination in two regions. If the next run starts from scratch, you're repeating a lot of API calls and potentially adding more pressure to an already throttled service.

I'd keep a checkpoint per service and region, including the last successful pagination state, scan timestamp, and completion status. I'd also distinguish between complete, partial, access_denied, and not_enabled rather than treating every missing result the same way.

There's an important difference between knowing what the scan found and knowing how much of the account it actually covered. I think making that distinction explicit in the result contract would make find_waste much more reliable at scale.

Curious to see how you implement this in v2.

πŸ”΄ Live TV: aws builders/mcp token cost i cut my mcp server from tools to cek - Jadwal Siaran Langsung
 
konstantin_0e4c2bb99bde9d profile image
Konstantin • • Edited

I was using local tools even before MCP was invented, so I never ran into such issues. When the universal standard was released, it was immediately obvious to me that it had been designed by a complete fool, so I fixed everything. I have never experienced any of the problems you described. It seemed obvious to me, and everyone had taken measures.

πŸ”΄ Live TV: aws builders/mcp token cost i cut my mcp server from tools to cek - Jadwal Siaran Langsung
 
sarvar_04 profile image
Sarvar Nadaf AWS Community Builders •

fair enough, if you saw it coming and avoided it from day one, you were ahead of most of us, a lot of people (me included) only felt it after wiring up a few servers and watching the context fill. the post is really for the folks who haven't hit that wall yet, so they measure before it costs them. curious what your local-tools setup looked like
before mcp, did you keep it after, or move over once the standard settled?

πŸ”΄ Live TV: aws builders/mcp token cost i cut my mcp server from tools to cek - Jadwal Siaran Langsung
 
alexshev profile image
Alex Shev •

The reduction is compelling because it treats tool design as an interface problem, not just a token problem. I would keep a regression suite of representative questions beside the smaller surface: fewer tools are only a win if the agent still chooses the right capability at the boundary cases.

πŸ”΄ Live TV: aws builders/mcp token cost i cut my mcp server from tools to cek - Jadwal Siaran Langsung
 
sarvar_04 profile image
Sarvar Nadaf AWS Community Builders •

agreed, and this is the check that makes tool-cutting safe instead of just cheaper, a regression suite of representative questions beside the smaller surface, so you can prove the agent still picks the right capability at the boundary cases after you collapse tools. the failure i'd watch for is the ambiguous question that used to resolve because a thin tool name disambiguated it, and now resolves wrong because one broad tool swallowed the distinction. fewer tools, same answers is the bar, not just fewer tools.

πŸ”΄ Live TV: aws builders/mcp token cost i cut my mcp server from tools to cek - Jadwal Siaran Langsung
 
alexshev profile image
Alex Shev •

Outcome-level tools help only if their return contract remains inspectable. I would pair each aggregated tool with a compact provenance field for every findingβ€”source check, region, and observation timeβ€”then make the detailed payload an explicit follow-up. That keeps the normal context footprint small while preserving a path to audit why the one-call answer is trustworthy.

πŸ”΄ Live TV: aws builders/mcp token cost i cut my mcp server from tools to cek - Jadwal Siaran Langsung
 
sarvar_04 profile image
Sarvar Nadaf AWS Community Builders •

Yeah, agreed. And there's a split worth making here. The cheap stuff source check, region, when it was seen can ride along on every finding. It's tiny and it's enough to trust the answer at a glance. The heavy stuff raw tags, full ARNs, the actual API response shouldn't. That's what detail=True is for.

The trap is treating them as one thing. The second you say "make it auditable" and shove everything into the default return, you've quietly dragged the 40-field blob back in and the saving's gone. So I keep provenance light by default and the real proof on demand, for the one finding I'm about to touch. Going to work this into the next version. Good nudge.

πŸ”΄ Live TV: aws builders/mcp token cost i cut my mcp server from tools to cek - Jadwal Siaran Langsung
 
alexshev profile image
Alex Shev •

Exactly. detail=True should be an explicit escalation path, not a default payload in disguise. I’d add a CI guardrail for the default response schema and size, so a well-meaning new field can’t quietly turn the cheap path back into the 40-field blob.

πŸ”΄ Live TV: aws builders/mcp token cost i cut my mcp server from tools to cek - Jadwal Siaran Langsung Thread
 
stefan_07d23f966225156b50 profile image
Stefan •

Alex, I'd include a large result set in that CI check too. Five fields per finding stays small until the account returns 2,000 findings. A bounded page with an explicit "more results" signal would keep the response manageable without making a partial scan look complete.

πŸ”΄ Live TV: aws builders/mcp token cost i cut my mcp server from tools to cek - Jadwal Siaran Langsung Thread
 
sarvar_04 profile image
Sarvar Nadaf AWS Community Builders •

yeah a ci check on the default return is exactly the right place for it. the thing that bit me isn't someone adding detail=True logic, it's someone appending "just one more useful field" to the default path over six months until it's quietly the 40-field blob again. so i'd assert two things in ci: the default key set is exactly the allowlist, and the per-finding char/token size stays under a cap. fails the build if either drifts. the schema toggle is easy to review, the slow creep isn't, so you pin it. are you running your tool schemas through ci already or is that a thing you'd be adding fresh?

πŸ”΄ Live TV: aws builders/mcp token cost i cut my mcp server from tools to cek - Jadwal Siaran Langsung Thread
 
sarvar_04 profile image
Sarvar Nadaf AWS Community Builders •

Stefan

good point, and that's a real hole in the current demo. my account returns 3 findings so i never felt it, but at 2,000 the lean response stops being lean, five fields times two thousand is its own blob. the fix is a bounded page plus an explicit "truncated, N more" signal so a partial scan never reads as a complete one, that last bit matters most for a cost tool because a silently-cut list makes the agent think it's seen everything and stop. putting a cap plus the truncation flag in the ci size check is the right call. adding it to the next pass.

πŸ”΄ Live TV: aws builders/mcp token cost i cut my mcp server from tools to cek - Jadwal Siaran Langsung Thread
 
alexshev profile image
Alex Shev •

That is a useful addition. The response can make the boundary explicit with a cursor or next-page token plus returned and total counts, so a caller can distinguish a deliberately bounded page from a complete scan.

πŸ”΄ Live TV: aws builders/mcp token cost i cut my mcp server from tools to cek - Jadwal Siaran Langsung Thread
 
sarvar_04 profile image
Sarvar Nadaf AWS Community Builders •

Yes

πŸ”΄ Live TV: aws builders/mcp token cost i cut my mcp server from tools to cek - Jadwal Siaran Langsung Thread
 
alexshev profile image
Alex Shev •

One edge case worth specifying is a changing dataset between pages: a cursor tied to a snapshot or stable sort order can prevent the caller from silently missing or repeating items. If the total is approximate, I would label it as such.

πŸ”΄ Live TV: aws builders/mcp token cost i cut my mcp server from tools to cek - Jadwal Siaran Langsung
 
stackmasteraliza profile image
Aliza Ali •

"Response bloat is half the problem" deserves its own post. On long sessions I'd expect trimming the 40-field boto3 blob to be the bigger win, because every bloated result stays in the transcript and gets re-read on every later turn. One nuance on the 55K figure: with prompt caching, static tool definitions get much cheaper in dollars after the first call, but they eat exactly as much context window. So 15 to 4 tools mostly buys back context and tool-selection accuracy, while trimming responses buys back both. Seven calls down to two for the same question is the number that really sells it.

πŸ”΄ Live TV: aws builders/mcp token cost i cut my mcp server from tools to cek - Jadwal Siaran Langsung
 
sarvar_04 profile image
Sarvar Nadaf AWS Community Builders •

"response bloat is half the problem deserves its own post" is fair, i gave it one section when it probably earns its own piece, because you're right that it's the bigger win on long sessions. schema cost is paid once at load, but a fat result sits in the transcript and gets re-read on every later turn, so trimming the 40-field blob compounds in a way the schema cut doesn't. and your caching nuance is the one i had to be corrected on earlier in this thread too, caching makes those 55k of tool defs cheap in dollars but they still eat the exact same context window, so 15β†’4 mostly buys back context and tool-selection accuracy while trimming responses buys back both. that's the honest split. the 7-2 is the seller because it attacks the per-turn cost, not the one-time load. you clearly think about the transcript-replay cost, are you trimming historical tool results outof context after N turns, or keeping them full and just eating the re-read?

πŸ”΄ Live TV: aws builders/mcp token cost i cut my mcp server from tools to cek - Jadwal Siaran Langsung
 
stackmasteraliza profile image
Aliza Ali •

Honestly, I'd rather not eat the re-read. The pattern that makes most sense to me: keep the last few tool results verbatim, and swap older ones for a one-line summary plus an ID the agent can re-fetch if it needs the detail again. The transcript stays cheap, and the agent doesn't lose track of what it already checked. That would make a great follow-up post too!

πŸ”΄ Live TV: aws builders/mcp token cost i cut my mcp server from tools to cek - Jadwal Siaran Langsung
 
tokenlat profile image
TokenLat •

Cutting the tool surface from 15 to 4 is the right reflex β€” fewer tools means less schema junk in every prompt, and the 88% drop is real. Two hidden costs survive the cleanup, though:

1) detail=True pulls a 40-field blob into context even when the call only needs 3 fields. That's a routing decision, not a schema toggle β€” route those result-heavy turns to a smaller model and the save holds.

2) Tool definitions get re-sent every turn, so you pay for them N times unless the gateway caches them. Cache them and the "default" per-turn cost approaches zero.

The quiet leak is almost always repeated context, not first-turn schema size. Do you meter per-turn tool-context cost separately, or only the first-turn number?

πŸ”΄ Live TV: aws builders/mcp token cost i cut my mcp server from tools to cek - Jadwal Siaran Langsung
 
sarvar_04 profile image
Sarvar Nadaf AWS Community Builders •

you're right and this is the honest gap in my table, i measured first-turn schema size, not the per-turn replay. tool defs ride at the front of every turn, so you pay them n times across a session unless the client caches the prefix, and with anthropic caching a hit is ~10% of base input so the per-turn cost basically collapses once it's warm. so the real number teams should watch is cached vs uncached per-turn, not the one-time load i put on screen. the routing idea is sharp too, detail=True turns are exactly the ones to send to a cheaper model since they're read-heavy and low-reasoning. i didn't meter per-turn separately, that's a fair hit. are you metering cached vs uncached turns in the gateway, or routing purely on result size?

πŸ”΄ Live TV: aws builders/mcp token cost i cut my mcp server from tools to cek - Jadwal Siaran Langsung
 
whiteknightonhorse profile image
whiteknightonhorse •

The 55,000 tokens for 93 GitHub tools is a number more MCP READMEs should show. We hit the same wall with a catalog of well over a thousand tools and ended up with one free discovery tool that ranks candidates and returns only their schemas. Did the four-tool version get worse on questions outside cost triage, or did it still cover them?

πŸ”΄ Live TV: aws builders/mcp token cost i cut my mcp server from tools to cek - Jadwal Siaran Langsung
 
sarvar_04 profile image
Sarvar Nadaf AWS Community Builders •

honest answer, my four tools are scoped to cost triage so outside that lane they don't pretend to cover it, i'd rather return nothing than a confident wrong answer. your discovery-tool approach is the right pattern for a thousand-plus catalog though, one free ranking tool that returns only candidate schemas is basically deferral done server-side, you never load the catalog, you load the two that matched. did the discovery step add a noticeable latency hit before the real call, or was the ranking cheap enough that it disappeared?

πŸ”΄ Live TV: aws builders/mcp token cost i cut my mcp server from tools to cek - Jadwal Siaran Langsung
 
whiteknightonhorse profile image
whiteknightonhorse •

Measured it just now. On the server side a discovery call takes about 40 to 65 ms, against about 30 ms for a plain health check, so the ranking itself costs tens of milliseconds. What the agent feels is the extra network round trip: from my laptop in Bangkok that is around 0.7 s, the same as any other request. It usually happens once per task, and the agent then calls the tool it picked directly.

πŸ”΄ Live TV: aws builders/mcp token cost i cut my mcp server from tools to cek - Jadwal Siaran Langsung Thread
 
sarvar_04 profile image
Sarvar Nadaf AWS Community Builders •

thanks for actually measuring it, that's the number i was guessing at. tens of ms of ranking lost in a single network round trip, once per task, is a great trade for not loading a thousand-tool catalog into context. that's basically deferral done server-side, you pay one cheap round trip to load the two tools that matched instead of carrying the whole catalog on every turn. the fact that the agent then calls the picked tool directly is the part that keeps it from turning into a per-call tax.

πŸ”΄ Live TV: aws builders/mcp token cost i cut my mcp server from tools to cek - Jadwal Siaran Langsung Thread
 
whiteknightonhorse profile image
whiteknightonhorse •

Server-side deferral is a good name for it, I might borrow that. The case I still watch is a long task where the agent's goal shifts halfway and it has to search again.

When you cut from 15 tools to 4, how did you pick the four? Usage logs, or a guess about what the agent would need most?

πŸ”΄ Live TV: aws builders/mcp token cost i cut my mcp server from tools to cek - Jadwal Siaran Langsung
 
vinmay profile image
Vinmay Nair •

Interesting results. I've been experimenting with a related problem in Whetherman, trying to figure out whether an agent actually needs to call a tool in the first place.

One thing I found was that even when an agent could answer correctly without tools, it would still call them surprisingly often and when I removed access to tools it sometimes generated more tokens or got the answer wrong.

I think there's another layer to optimizing MCP costs here. Reducing the number of tools makes sense, especially when several tools can be combined into one. But an agent can still make unnecessary calls with just 4 tools. So even after simplifying the server, there's still the question of whether a tool needed to be called at all.

πŸ”΄ Live TV: aws builders/mcp token cost i cut my mcp server from tools to cek - Jadwal Siaran Langsung
 
sarvar_04 profile image
Sarvar Nadaf AWS Community Builders •

this is a sharp layer on top of mine, and honestly the next question after the one i answered. i cut the number of tools, but you're pointing at whether a tool should've been called at all, which is a harder problem. the thing you found, that agents over-call even when they could answer cold, and sometimes do worse with tools removed, is a real tension: tools are a crutch and a liability at once. 4 tools still leaves room for an unnecessary call. what's steering it in whetherman, prompt discipline or something structural in the tool surface?

πŸ”΄ Live TV: aws builders/mcp token cost i cut my mcp server from tools to cek - Jadwal Siaran Langsung
 
sarvar_04 profile image
Sarvar Nadaf AWS Community Builders •

πŸš€ Want to see the lean MCP approach in action or explore the code?

πŸŽ₯ Full YouTube Demo:

youtu.be/1EGeu4jCaR0?si=gb0DZ1SZdw...

πŸ’» GitHub - Complete Source Code:

github.com/simplynadaf/aws-lean-mcp

If you're building MCP servers for AWS or AI agents, feel free to fork the repo, experiment with it, and share what you improve. πŸ™Œ

⭐ If you find the project useful, consider starring the repo!

Picked as gem
πŸ”΄ Live TV: aws builders/mcp token cost i cut my mcp server from tools to cek - Jadwal Siaran Langsung
 
alexcodebytes profile image
Oleksandr •

The 'outcome-level' tool design is the real unlock here. Wrapping every single API endpoint 1:1 is why agents get confused and start hallucinating.

Also, I really appreciate the honesty about the context meter. Most posts about MCP token bloat show a dramatic 70% drop on a tiny demo, which is mathematically impossible. Your point that it saves 0.3% on 15 tools but 20%+ on a production setup of 90+ tools perfectly explains why this matters at scale.

To answer your question: my primary MCP server has 12 tools, but reading this makes me want to go refactor them all into 3 or 4 outcome-level tools right now.

πŸ”΄ Live TV: aws builders/mcp token cost i cut my mcp server from tools to cek - Jadwal Siaran Langsung
 
sarvar_04 profile image
Sarvar Nadaf AWS Community Builders •

Thank you, you picked out the two bits I cared about most.

The 1:1 wrapping thing is the whole problem. When every tool is just a thin mirror of an API, the model has to be the one stitching the workflow together, and that stitching is where it starts guessing and hallucinating. Outcome-level tools take that job off the model it just says "where am I wasting money" instead of running five list-and-filter calls and hoping.

And yeah, I wasn't going to fake the number. On 15 tools it's basically nothing. This only earns its keep once you're past 90-odd tools always loaded, which is exactly where you end up after bolting on a few MCP servers. The "70% saved" posts running a 5-tool demo are selling a story the math doesn't back up.

12 is a nice place to start from enough to feel it, small enough that going to 3 or 4 is a weekend. If you do it, measure the context before and after on one real prompt and drop the number here. I'd love to see a 12β†’4 from an actual setup instead of another demo.

πŸ”΄ Live TV: aws builders/mcp token cost i cut my mcp server from tools to cek - Jadwal Siaran Langsung
 
alexcodebytes profile image
Oleksandr •

"Outcome-level tools" is the exact phrase I needed. The model shouldn't be a workflow orchestrator stitching together five different API endpoints; it should just be a decision-maker calling one high-level action.

I'll take you up on the 12β†’4 challenge. My context is currently bloated with exactly those thin 1:1 wrappers. I'll measure the token count on a complex prompt before the refactor, collapse them into 3-4 outcome tools, and drop the real numbers here once it's tested.

Thanks for keeping the benchmark honest!

πŸ”΄ Live TV: aws builders/mcp token cost i cut my mcp server from tools to cek - Jadwal Siaran Langsung Thread
 
sarvar_04 profile image
Sarvar Nadaf AWS Community Builders •

love this. you nailed it better than my own post: decision-maker calling one high-level action, not a workflow orchestrator. yes please drop the before/after numbers here once you've tested it, the measured ones not the vibes. one thing that bit me on the refactor: watch the response payload too, not just the tool count. collapsing 12 wrappers into 4 wins nothing if each one still hands back the full 40-field blob. what's your context bloated with mostly, thin read wrappers or fat returns?

πŸ”΄ Live TV: aws builders/mcp token cost i cut my mcp server from tools to cek - Jadwal Siaran Langsung Thread
 
alexcodebytes profile image
Oleksandr •

Yep, and this is where most refactors go to die. People obsess over the tool count and completely ignore the payload. I’ve seen servers go from 20 tools down to 5, but each call still dumps a 400-token JSON blob back into the context, so you didn't actually save any money.

To answer your question: mine was mostly the "fat returns" problem, but specifically, it was nested metadata. A single read call would return the object, then an array of tags, then another nested array of permissions. Stripping that down to just the essential IDs and the current state was what actually dropped my token usage, not the tool reduction itself.

Definitely post the before/after numbers when you have them. The "vibes" are always great after a refactor until you see the actual context window graphs flatline.

πŸ”΄ Live TV: aws builders/mcp token cost i cut my mcp server from tools to cek - Jadwal Siaran Langsung Thread
 
sarvar_04 profile image
Sarvar Nadaf AWS Community Builders •

yes, nested metadata is the exact shape that got me too. in v1 a single describe handed back the object, then tags, then a whole state block the agent never touched. stripping to id + current state is where the real drop lived, not the tool count, the tool count is just the part that looks good in a table. one thing i'd watch when you measure: whether those fat returns are read-once or re-read. a bloated payload that stays in the transcript gets paid again every later turn, so the graph you want flat is cumulative, not per-call.

πŸ”΄ Live TV: aws builders/mcp token cost i cut my mcp server from tools to cek - Jadwal Siaran Langsung Thread
 
alexcodebytes profile image
Oleksandr •

The cumulative cost trap is the real killer. A bloated payload doesn't just tax you once; it bleeds you on every single subsequent turn. We started aggressively summarizing or truncating old tool outputs in the history just to keep that graph flat. Great insight!

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