DEV Community

Cover image for Your coding agent doesn't need more MCP tools. It needs a map.
Syed Fahad for Graphify Labs Inc

Posted on

Your coding agent doesn't need more MCP tools. It needs a map.

The MCP conversation on DEV this month has been great. "MCP Is Dead Simple. And That's Exactly the Problem" and "MCP Token Cost: I Cut My MCP Server From 15 Tools to 4" both land on the same point: MCP is easy to add, and that's exactly how your context window disappears.

I agree. And I think there's a second half to it that we don't talk about enough.

Even with a lean tool list, a coding agent still burns most of its context on one thing: finding its way around your code. Grep, open a file, grep again, open three more. More tools don't fix that. A map does.

I work on Graphify, so I have a horse in this race. But the numbers below are from my own terminal, and you can rerun every one of them.

Two places your tokens go

1. Tool definitions. Every tool schema sits in context on every turn, whether the agent uses it or not. The 15-tools-to-4 post cites GitHub's official MCP server at about 55,000 tokens across 93 tool definitions before you ask a single question. Stack five or six servers like that and you've spent a big slice of the window on menus.

2. Navigation. This one is sneakier. The agent asks "who calls this function?" and the only way it knows to answer is to search text and read files. Files are big. The answer is small.

Most of the advice so far targets the first problem: fewer, sharper tools. That's right. Here's what happens when you also go after the second one.

The experiment: one question, two ways

Repo: Click, the Python CLI library, at commit 8abb77a. Question: "What calls make_context, and what does it call?" Token counts use OpenAI's o200k_base tokenizer via tiktoken.

Way 1: grep and read

grep -rn make_context --include='*.py' --include='*.md' .
Enter fullscreen mode Exit fullscreen mode

12 matches across 5 files. The grep output itself is tiny, about 257 tokens. But matches aren't answers. Grep tells you where the string appears, not who calls whom. So the agent opens the files to figure it out.

Those 5 files add up to about 48,900 tokens. src/click/core.py alone is about 33,600.

Way 2: ask the graph

I built a graph of the same repo once (graphify update ., about 3 seconds, no LLM, no embeddings) and served it over MCP with graphify-mcp. Then one tool call:

{ "tool": "get_neighbors", "arguments": { "label": "make_context" } }
Enter fullscreen mode Exit fullscreen mode
Neighbors of .make_context():
  --> .parse_args() [calls] [EXTRACTED] at=src/click/core.py:L1389
  --> Any [references] [EXTRACTED] at=src/click/core.py:L1355
  --> Context [references] [EXTRACTED] at=src/click/core.py:L1355
  <-- .main() [calls] [EXTRACTED] at=src/click/core.py:L1584
  <-- Command [method] [EXTRACTED] at=src/click/core.py:L1355
  <-- This function when given an info name and arguments will kick off the parsing… [rationale_for] [EXTRACTED] at=src/click/core.py:L1362
  <-- _resolve_context() [calls] [INFERRED 0.85] at=src/click/shell_completion.py:L706
Enter fullscreen mode Exit fullscreen mode

That's about 188 tokens. Callers, callees, file and line for each, and a tag on every edge: EXTRACTED means read straight from the source, INFERRED means resolved by Graphify with a confidence score.

It even caught the cross-file caller, _resolve_context() in shell_completion.py. That's the one you'd miss if you only opened core.py.

The scoreboard

Grep + read Code graph over MCP
Calls to answer 1 search + up to 5 file reads 1
Tokens in context ~257 search + ~48,900 files ~188
Says who calls whom You work it out Yes, with direction
File and line per hop From grep only Yes

And the tool menu that makes this possible? graphify-mcp exposes 10 tools. I dumped their names, descriptions and input schemas from the server: about 1,600 tokens total.

So what does "a map" actually mean?

Not a bigger prompt. Not a CLAUDE.md that goes stale. A structure the agent can query:

  • Nodes for functions, classes, modules and docs
  • Edges for calls, imports, references and inheritance
  • Communities that roughly match your subsystems (Click has 213)
  • Freshness baked in. graph_stats on Click ends with Built at commit: 8abb77a… (matches HEAD), so the agent knows the map matches the code.

Once that exists, a lot of questions collapse into one call:

  • "Who calls this?" → get_neighbors
  • "How does A reach B?" → shortest_path
  • "What's the core of this repo?" → god_nodes
  • "Give me just enough context for this question" → query_graph, which stays inside a token budget (2,000 by default)

That's the same lesson as the lean-tools posts, applied to the codebase instead of the API: give the model fewer, better-shaped things to look at.

Try it on your repo (5 minutes)

pip install "graphifyy[mcp]"
cd your-repo && graphify update .
claude mcp add --transport stdio graphify -- graphify-mcp "$(pwd)/graphify-out/graph.json"
Enter fullscreen mode Exit fullscreen mode

Cursor and other JSON clients work too. The MCP server docs have every config. If you'd rather not run anything locally, hosted Graphify indexes your GitHub repos and keeps the graph fresh, and it connects to Claude Code with one command.

If this was useful, a ⭐ on GitHub genuinely helps.

Your turn

I'm curious where everyone's tokens actually go.

When you look at a long agent session, what eats more of your context: tool definitions, or the agent reading files to find its way around? Drop your numbers or your gut feel in the comments. I'll rerun this experiment on any public repo you name.

Top comments (1)

Collapse
 
raju_dandigam profile image
Raju Dandigam •

The EXTRACTED versus INFERRED edge labels and the “built at commit” check make the 188-token answer inspectable, not just compact. I would be interested in the same experiment on a TypeScript repo with dynamic imports or dependency injection, where a static call graph may leave gaps. Do you expose unresolved edges so the agent knows when to fall back to reading source?