Most of my Claude Code input tokens weren’t my code
I logged the raw requests from one Claude Code session on a real repo to see where the input tokens actually go. I expected the files the agent read to dominate.
Input was about 123k tokens:
~74% tool definitions
~21% conversation, including a 40 KB file the agent read
~5% system prompt
So most of it was the list of tools the agent can call, sent again on every request. The file I was worried about was a small slice.
It’s one session on one setup, so take it with a grain of salt. My guess is it scales with how many MCP servers you have connected, since each one adds its own tool definitions.
If you want to check yours without any extra tooling, " /context " inside Claude Code shows a rough breakdown, including how much the MCP tools take up.
Curious what others see. Do tool definitions eat most of your context too, or is it mostly code and conversation for you? And has anyone tried trimming MCP servers per project to bring it down?

p/kodlo
p/many-displays
p/producthunt
p/wellows-3
p/runevr
p/google-cloud-platform
p/reso
p/meridian-16
p/zush
p/beamfy
p/make0-brain
p/expert-chase-deleted-1107920
p/lancetta
p/netfox
p/stackscope-dev
p/monocloud-for-startups-free-for-1-year
p/magic-lasso-adblock
p/comcent
p/vitals-3
Replies
The agent ran out of context reading the test fixtures and silently cut half the assertions. A hard crash is easy to debug, but showing a green summary when it gave up halfway through breaks trust.
@konstantin_tikhaev Yeah, that’s the worst kind. A crash at least tells you something went wrong. Did it say anywhere that it skipped them, or did you catch it later?
@mertcansaglam The output gave no warning. It only showed up later when reviewing the git diff before committing.
@konstantin_tikhaev The git diff catching it is the scary part, since a lot of people skip that step when the summary looks green.
@mertcansaglam This blind trust quietly hollows out test suites. Until these tools treat context truncation as an outright failure, diff reviews are the only real safeguard left.
Same picture here before I changed anything. I have a lot connected: the Play Console server alone exposes a couple hundred tools, plus Gmail, Drive, Atlassian and the browser. With tool search on, they now show up as names only and get loaded when a task actually needs them, so most sessions never pay for the Play Console list at all. The other big chunk for me was my own project notes. My CLAUDE.md kept growing, so I cut it down to the rules that apply to every change and moved the rest into one file per area, with a table at the top saying which file to read before touching what. The agent pulls in the store notes only when it works on the store. Also worth remembering that a repeated prefix like tool definitions is cached, so it hurts the context window more than the bill.
@gbasovv A couple hundred tools from one server explains a lot. The one-file-per-area setup for CLAUDE.md is a good idea, I might try that. Fair point on caching too, it’s more of a context problem than a cost one.
@mertcansaglam If you try it, one thing that helped me: keep the table of files in the main notes short and literal, like "touching the store copy, read store.md". When it was a vague list of topics the agent skipped the files. And when it learns something new, have it write that into the area file right away, otherwise the main file starts growing again.
@gbasovv "touching the store copy, read store.md" is very clear, I'll copy that format. Writing the lesson into the area file right away also makes sense, otherwise it ends up back in the main file.
@mertcansaglam Glad it helps. Would love to see your token split again after the rerun with tool search on and a slimmer main file, I'm curious how far the 74% drops.
Claude Code has a setting for this: ENABLE_TOOL_SEARCH=auto defers MCP tool definitions and loads them on demand, instead of sending every one on each request. Worth rerunning your test with it on. My harness does the same by default: the core tools stay loaded and the rest sit behind one entry the agent can list and call.
@wwenioaguiar Didn’t know about that setting, thanks. I’ll rerun the same session with it on and see how the split changes.
I ran into this from the memory side. I had Gmail, Calendar, Drive, Zoom, LINE and a couple of internal servers all connected as MCP, and each one was taking about 560MB per session.
Since early October they're not connected anymore. A small command starts the server only when the agent actually needs it, so their tool definitions don't sit in the context either.
@hisashispace Hadn’t thought about the memory side at all. How does it decide when to start a server? Do you call it by name?
@mertcansaglam By name. There's a small skill that lists the servers and their tools, and the agent only loads it when the task needs one of them. When it wants Gmail, it runs one command with the server name, the tool and the JSON args. That starts the server if it isn't already running, and makes the call. If a server sits unused for a while, it shuts itself down to save resources. A hook still applies the same permission rules as before, so sending mail still needs my OK.
A full day went to debugging after the agent printed a report with a confident metric nobody had actually measured. It had pulled an unreplaced placeholder from a mock setup into context and presented it as real execution data.
The agent burned context re-reading test logs, then quietly loosened the assertion to check truthy instead of matching the payload. The suite stayed green for days until production broke. Test files have to stay completely out of the agent's edit scope.