Skip to main content
Glama

Estimate the cost of one request

estimate_cost
Read-onlyIdempotent

Cost of one request from the recorded prices and the channel's billing rules (long-context thresholds, time-of-day prices, thinking-token billing), each rule with its source excerpt. Where the sources leave a question open the answer is a range with the reason, never a guess; a price that is not recorded is unknown. List prices as published by each channel at observed_at, USD per 1M tokens unless stated; China-site price lists are in CNY, listed separately and never converted. Standard (on-demand) plan unless service_plan says otherwise. The channel's own page is authoritative. Aggregator prices are the marketplace's own and never the reference. A missing price is unknown, not free. Not purchasing advice.

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>",
      "input_tokens": "<input_tokens>",
      "output_tokens": "<output_tokens>"
    },
    "name": "estimate_cost"
  }
}

Input Schema

NameRequiredDescriptionDefault
atNoRequest time, ISO 8601, for channels that price by time of day
modelYesModel id such as openai/gpt-6.1-sol, or an alias the channels use (gpt-6.1-sol, claude-opus-5-5). Case-insensitive.
channelNoChannel id; default is the official channel
input_tokensYesUncached input tokens
service_planNoDefault STANDARD
output_tokensYesVisible output tokens, without thinking tokens
reasoning_tokensNoThinking / reasoning tokens, counted separately from output_tokens
cache_write_tokensNoTokens written to a cache
cached_input_tokensNoTokens read from a cache

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A3.6/5.0
Behavior4/5

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

Annotations already cover safety (readOnly, idempotent, non-destructive, closed-world), yet the description adds substantial behavior: answers may be ranges with reasons rather than guesses, each rule is returned with its source excerpt, unrecorded prices are reported as unknown rather than zero, and CNY lists are never converted. The source-authority hierarchy (channel page over aggregators) is real operational context an agent could not get from annotations. It stops short of describing the response shape or failure behavior for unresolvable models.

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

Conciseness3/5

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

Purpose is front-loaded in the first sentence, and most following clauses carry genuine policy content. However, the unknown-price rule is stated twice ('a price that is not recorded is unknown' and 'A missing price is unknown, not free'), and the description runs as an undifferentiated block of caveats with no separation between inputs, defaults, and output conventions.

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 nine-parameter, read-only estimation tool with no output schema, the description covers the important conventions: default plan and channel, currency units per 1M tokens, range-versus-guess policy, source attribution, and the unknown case. What remains thin is the exact result structure and how ambiguity in model aliases or missing channels is handled.

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 nine parameters are already documented with types and meanings; the baseline applies. The description reinforces why certain parameters matter (long-context thresholds, time-of-day prices motivating at, separate thinking-token billing motivating reasoning_tokens) and states currency/normalization rules. It does not map rules to specific parameters or clarify interactions such as channel versus observed_at selection.

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 opening clause states a specific computation: the cost of one request derived from recorded prices plus the channel's billing rules. It is clearly a calculator rather than a price lookup, which implicitly separates it from siblings like get_price or compare_channels. It never names those siblings explicitly, so the differentiation is inferential rather than stated.

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 framing (compute a single request's cost) and by stated defaults — official channel unless channel is given, STANDARD plan unless service_plan says otherwise. There is no explicit when-to-use versus when-to-use-a-sibling guidance, and no mention of what inputs are prerequisites beyond the required three. The agent must infer that price-listing tools are the alternative.

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.