Skip to content
mentoor

Topic 1 of 5 · 4 min read

Tool definitions as a standing token cost

Goal: Measure how much context an agent's tool and MCP setup uses before the task starts and cut what the task does not need.

Every tool you connect is text the model must read on every turn, before it reads your task. A tool is not free just because you never call it.

Check yourself · 1 of 3

An agent has five MCP servers connected and you give it a one-line task. When does it pay the token cost of their tool definitions?

Choose one answer

Why it matters

An agent sees each tool as a name, a description and a JSON schema for its arguments. That text goes into the request on every turn and counts against the context window like your prompt does. One small tool is cheap. A GitHub server, a database server, a browser server and a ticket server can together add tens of thousands of tokens. The agent has less room for your code, the history is compacted sooner, and each turn costs more and runs slower. Anthropic's write-ups on advanced tool use and on code execution with MCP describe this standing cost as a main reason for loading tools on demand.

How to measure it

  1. Start a clean session with no task. Ask the tool for its context breakdown (Claude Code has a /context command; other agents show token counts in a debug view or API usage).
  2. Read the line for tools or MCP. That is your standing cost, paid before any work.
  3. Compare servers. Disconnect one server, measure again. The difference is that server's price.
  4. Check the schemas. Long descriptions, big enums and deeply nested parameters are the usual heavy parts.

How to cut it

  • Connect only the servers this task needs. Use per-project config, not one global list.
  • Prefer a few well-designed tools to many thin ones.
  • Shorten descriptions to what the model needs to choose the tool: what it does and when to use it.
  • Turn off tools you never call in a given workflow.

Before and after

{
  "mcpServers": {
    "github": { "command": "npx", "args": ["github-mcp"] },
    "postgres": { "command": "npx", "args": ["pg-mcp"] },
    "browser": { "command": "npx", "args": ["browser-mcp"] },
    "jira": { "command": "npx", "args": ["jira-mcp"] },
    "slack": { "command": "npx", "args": ["slack-mcp"] }
  }
}

The task is "fix a failing unit test". Only the repository matters. A project config that lists just github (or none, if the agent already has file and shell tools) leaves the window for the code and the test output.

What goes wrong

  • Global servers everywhere. A server added once for a side project follows you into every session.
  • Never measuring. People guess the cost is small. Look at the number.
  • Cutting the wrong thing. Removing the one tool the task needs makes the agent improvise with worse tools. Cut by task, not by habit.

Examples

Pricing one server

A clean session reports the tools line at a given size. You disconnect the browser server and measure again; the number drops by the size of its schemas. If the task never opens a web page, that server was pure standing cost. Write the number in the project README so the next person sees the price.

Trimming a verbose description

{
  "name": "search_issues",
  "description": "Search issues. Use for finding bugs by keyword or label. Returns id, title, state. Not for pull requests."
}

Five short sentences say what it does, when to use it and when not to. A three-paragraph history of the issue tracker adds cost and no help in choosing the tool.

Key points

  • Tool names, descriptions and schemas are sent on every turn and use context even when no tool is called.
  • The standing cost grows with every connected MCP server, and a few servers can use a large share of the window.
  • Measure by starting a clean session, reading the tools line of the context breakdown, and removing one server at a time.
  • Connect tools per project or per task rather than globally, and keep descriptions short but clear about when to use the tool.
  • Cut by what the task needs: removing a needed tool is as costly as keeping ten unused ones.

Common mistakes

  • Adding every server that looks useful to a global config and never reviewing it.
  • Assuming unused tools are free because they are never called.
  • Guessing the cost instead of reading the context breakdown of a clean session.
  • Pasting long documentation into tool descriptions instead of keeping it in a skill or a doc the agent reads when needed.

Check yourself · 2 of 3

What is the quickest way to see how much context your tool setup uses?

Choose one answer

Check yourself · 3 of 3

Your agent only needs to edit files and run tests, but five MCP servers are connected globally. Best first change?

Choose one answer

Practice items, not counted towards your mastery.

Start here

More for this topic