Skip to main content
Glama

Estimate the cost of one Gemini 4 agent run

estimate_agent_run

Turn-by-turn cost of a Gemini 4 agent run: every turn re-sends the growing context as input, thinking tokens are billed at the output rate. Returns the rates in force on the chosen date, the simulated total, the naive first-turn × turns estimate and their multiplier. Before the 2026-12-01 price change it also returns afterIncrease: the same run priced at the announced 2026-12-01 rates.

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": {
      "modelId": "<modelId>",
      "thinkingLevel": "<thinkingLevel>",
      "turns": "<turns>",
      "initialContextTokens": "<initialContextTokens>",
      "contextGrowthPerTurn": "<contextGrowthPerTurn>",
      "userToolInputTokensPerTurn": "<userToolInputTokensPerTurn>",
      "outputTokensPerTurn": "<outputTokensPerTurn>"
    },
    "name": "estimate_agent_run"
  }
}

Input Schema

NameRequiredDescriptionDefault
dateNoISO date (YYYY-MM-DD) that selects the price segment in force that day. Defaults to today (UTC).
turnsYesNumber of turns (separate API calls) in the run.
modelIdYesGemini 4 model to price.
thinkingLevelYesThinking budget. Thinking tokens are billed at the output price: off = 0×, low ≈0.5×, medium ≈1.5×, high ≈3× the visible output tokens.
outputTokensPerTurnYesVisible answer tokens per turn, excluding thinking.
contextGrowthPerTurnYesNet history added after each completed turn; billed from turn 2 onward.
initialContextTokensYesSystem prompt, tool definitions and documents sent on turn 1.
userToolInputTokensPerTurnYesNew user/tool content billed on top of the context each turn.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

B3.4/5.0
Behavior3/5

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

With no annotations, the description carries the full burden, and it does disclose real behavioral content: context is re-sent each turn, thinking tokens bill at output rate, and an afterIncrease block appears only before 2026-12-01. However, it omits whether this is a pure local computation or a billable/authenticated call, and gives no error behavior or currency/units, which is a meaningful gap for an unannotated tool.

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 dense sentences, front-loaded with the cost model before the return-value list, with no filler. The second sentence is packed with several return fields at once, which slightly taxes parsing but every clause carries information.

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

Completeness3/5

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

For an 8-parameter, no-annotations, no-output-schema tool, the description does part of the output-documentation job by naming the returned rates, simulated total, naive estimate, multiplier and afterIncrease. It still leaves return semantics underspecified (what exactly the multiplier divides by, currency/units, rounding), which matters when nothing else documents the response.

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 100%, so every parameter is already documented, including the thinking-level multipliers. The description does add one thing beyond the schema: it ties the date parameter to the 2026-12-01 price segment and the afterIncrease output, but it adds nothing for turns, contextGrowthPerTurn, or outputTokensPerTurn beyond what the schema says.

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 resource and outcome ('Turn-by-turn cost of a Gemini 4 agent run') and immediately explains the cost model that makes it distinct from raw pricing. It never names the sibling get_gemini_pricing, so the distinction from a plain price-lookup tool is only implicit, but an agent can infer it's a simulation tool rather than a rate table.

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?

Usage is implied by the described mechanics (multi-turn runs, growing context, thinking-token billing) rather than stated as explicit when-to-use guidance. There are no exclusions or pointers telling the agent when to prefer get_gemini_pricing instead of this estimator.

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.