Skip to main content
Glama

calculateLlmTokenPricing

Read-only

Calculates exact input, cached-input, and output token costs across frontier LLMs (OpenAI, Anthropic, Gemini, DeepSeek, Meta) and recommends optimal model routing. Price: 0.010 USDC on Base or Solana.

Input Schema

NameRequiredDescriptionDefault
modelNoclaude-3-7-sonnet

Output Schema

NameRequiredDescriptionDefault
modelYes
estimated_cost_usdYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "properties": {
      +    "estimated_cost_usd": {
      +      "type": "number"
      +    },
      +    "model": {
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "model",
      +    "estimated_cost_usd"
      +  ],
      +  "type": "object"
      +}
  2. Added

TDQS

C2.9/5.0
Behavior3/5

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

Annotations already declare readOnlyHint=true and openWorldHint=true, so safety is covered. The description adds genuinely useful non-annotation context: the call is paid at 0.010 USDC on Base or Solana, implying an on-chain payment step the agent must anticipate. It stops short of explaining how payment is authorized or what happens on payment failure.

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 short sentences, front-loaded with the core capability and followed by the cost line. No filler. Slightly awkward that pricing/payment details are tacked on in the same breath as the capability rather than structured separately, but nothing is wasted.

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

Completeness2/5

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

An output schema exists, so return values need not be described. However, for a 'calculates costs' tool whose only parameter is a model name, the description leaves the critical question unanswered: where do the token counts come from, and which model identifiers are accepted? An agent cannot reliably construct a call from this.

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

Parameters2/5

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

Schema coverage is 0% for the single parameter, and the description never mentions it — the default model 'claude-3-7-sonnet' is documented nowhere except the schema's default field. It is also unclear how token counts enter the calculation given only a model name; the description does not compensate for that gap.

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: calculates input, cached-input, and output token costs across named providers, plus a routing recommendation. No sibling is close in function, so differentiation is implicit. The second half ('recommends optimal model routing') slightly dilates the purpose beyond pure pricing without explaining what routing means, keeping it just short of a 5.

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

Usage Guidelines2/5

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

No statement of when a caller should use this rather than another tool, no prerequisites, and no mention of what the caller must supply to get a cost (the schema exposes only a model name). The only contextual cue is the price line, which tells you it costs money but not when to spend it.

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.