Skip to main content
Glama

TokenBudget

Budget a multi-turn agent run

plan_agent_run
Read-onlyIdempotent

Estimate the total cost of an agent loop that re-sends its growing context every turn, with prompt caching, on many models. Returns total cost, peak context, how many turns fit in each model's context window, how many turns fit in a budget, and a recommended model. Use before starting a long agent task.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "turns": "<turns>"
    },
    "name": "plan_agent_run"
  }
}

Input Schema

NameRequiredDescriptionDefault
cacheNoAssume prompt caching of the previous turn. Default true.
turnsYesNumber of model calls in the loop.
modelsNoModel ids to compare, e.g. ["claude-sonnet-5-5", "gpt-6.2-sol", "gemini-3.8-flash"]. Omit to compare every listed model. list_models gives every id.
providersNoOnly these providers.
budget_usdNo
task_tokensNoTokens of the first user message.
tools_tokensNoTokens of tool definitions sent every turn.
system_tokensNo
output_tokens_per_turnNoDefault 800.
tool_result_tokens_per_turnNoDefault 1500.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A3.7/5.0
Behavior4/5

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

Annotations already establish this as a read-only, idempotent, closed-world computation, so the safety bar is low. The description still adds real behavioral value by disclosing the modeling assumptions (context grows and is re-sent every turn, prompt caching assumed) and by enumerating the outputs returned, including a recommended model.

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

Conciseness4/5

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

Two sentences, both front-loaded: the first defines the computation, the second enumerates outputs, the third gives the call-to-action. Dense and free of filler, though the output enumeration is delivered as a long comma-spliced list rather than a more scannable structure.

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?

With 10 parameters, no output schema, and a non-trivial cost model, this description does what is needed: it explains the underlying model and lists every returned value, so the agent knows what it will get back. The remaining gap is the absence of any guidance on how the results relate to sibling tools like check_context_fit.

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 coverage is 80%, so the schema already documents most parameters, and the baseline of 3 applies. The description adds partial meaning — it clarifies that `budget_usd` drives the "how many turns fit in a budget" output and that `cache` reflects the prompt-caching assumption — but says nothing about `task_tokens`, `system_tokens`, or `tools_tokens` beyond what the schema states.

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 ("Estimate the total cost of an agent loop") with meaningful scope qualifiers: growing context re-sent each turn, prompt caching, and multi-model comparison. That scope implicitly separates it from a single-call cost estimator, but it never names a sibling to make the distinction explicit.

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

Usage Guidelines3/5

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

"Use before starting a long agent task" gives one clear triggering context, which is genuine when-to-use guidance. However, there are no exclusions and no routing to alternatives, even though check_context_fit and estimate_cost are close siblings whose overlap (context window fit, cost estimation) is left for the agent to infer.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources