Skip to main content
Glama

TokenMargin

calculate_agent_loop_cost

Compute exact monthly LLM API spend and multi-turn context accumulation bloat for an autonomous coding or tool-use agent loop (1-20 turns).

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": {
      "model": "<model>"
    },
    "name": "calculate_agent_loop_cost"
  }
}

Input Schema

NameRequiredDescriptionDefault
dauNoDaily Active Users or Engineers (default 100)
modelYesModel ID or name (e.g. "anthropic/claude-sonnet-5.5" or "deepseek-r1")
turnsNoMulti-turn agent loop depth 1-20 (default 12)
cacheHitPctNoPrefix KV-cache hit % 0-95 (default 75)
inputTokensNoBase system + user prompt tokens on turn 1 (default 4000)
tasksPerDayNoAgent tasks per user per day (default 15)
outputTokensNoAvg output tokens per turn (default 800)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

B3.3/5.0
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states what is computed but does not disclose underlying assumptions, pricing source, determinism, side effects, or output format, leaving important behavioral context unspecified for a cost-calculation tool.

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?

The description is a single front-loaded sentence with no redundant or filler wording. It efficiently states the computation target and scope.

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?

The tool has seven parameters but fully documented schema coverage, and there is no output schema. The description is adequate to understand the broad purpose, but it does not explain the return structure or key assumptions, which would help an agent use the results correctly.

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 seven parameters are already documented in the input schema. The description adds only the 1-20 turn scope and does not provide additional meaning about fields such as cacheHitPct, tasksPerDay, or inputTokens beyond what the schema already 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?

The description uses a specific verb, 'Compute,' and names the resource: monthly LLM API spend and multi-turn context accumulation bloat. It scopes the calculation to autonomous coding or tool-use agent loops of 1-20 turns, making the purpose clear, but it does not explicitly distinguish this from siblings such as get_llm_pricing or compare_models.

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 through the mention of autonomous coding or tool-use agent loops and the 1-20 turn range. However, the description gives no explicit guidance on when to choose this tool over get_llm_pricing or compare_models, nor does it state any exclusions or prerequisites.

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