Skip to main content
Glama
mcp-context-budget

mcp-context-budget

by yuehancn

audit_context_budget

Measure how many tokens each MCP server's tools consume in the context window, ranking servers and tools by cost so you can find waste before adding another server.

Instructions

Measure how many tokens the configured MCP servers consume in the context window. Probes each stdio server, reads its real tools/list payload, and reports cost per server and per tool against a chosen window size. Use when the agent feels degraded after adding servers, or before installing another one. Read-only.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "audit_context_budget"
  }
}

Input Schema

NameRequiredDescriptionDefault
configNoPath to an MCP client config file. Defaults to auto-discovering Claude Desktop, Cursor, WorkBuddy and project-level configs.
windowNoContext window size to measure against.200k
show_toolsNoAlso list the N most expensive tools per server. Default 0.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations supplied, the description carries the burden and mostly does: it declares 'Read-only', discloses that it actively probes stdio servers and reads their real tools/list payloads (a runtime side effect an agent should know about), and states the output shape (per-server and per-tool cost against a window size). It omits that only stdio servers are probed, so non-stdio servers are silently excluded, and gives no sense of probing latency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three sentences plus a 'Read-only.' fragment: capability and mechanism first, then the usage trigger, then the safety profile. Every sentence earns its place, including the trailing safety note that substitutes for the missing annotations.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a three-optional-parameter, no-output-schema, no-annotation tool, the description covers purpose, mechanism, triggers, and read-only safety, which is enough to call it correctly. The remaining gap is scope — it does not say whether non-stdio/HTTP servers are measured, which matters given the config auto-discovery behavior.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so all three parameters — config path with auto-discovery fallback, the window enum with its default, and show_tools N — are already documented in structured fields. The description adds only the framing phrase 'against a chosen window size', which restates the schema rather than extending it.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource — measure token consumption of configured MCP servers — and even explains the mechanism (probe each stdio server, read its real tools/list payload, report cost per server and per tool against a chosen window size). It never names or contrasts with the siblings explain_token_cost or rank_servers_by_cost, so an agent must infer the boundary itself.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives two concrete triggers: when the agent feels degraded after adding servers, and before installing another one. That is clear positive guidance, but it offers no exclusions or explicit routing to the sibling tools that explain or rank the same costs.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.