Skip to main content
Glama

Estimate the cost of a chain

estimate
Read-onlyIdempotent

Pre-price AI invocation chains before spending: calculate per-step USD cost bounds and chain totals to compare routes or budget multi-model pipelines—no calls or charges.

Instructions

Pre-price an invocation chain BEFORE spending money. Each step is either a concrete offering ("node_id/offering_id") or a select query that picks the best match, plus expected input and output tokens. Returns per-step cost bounds in USD, the pinned card_revision that makes each estimate enforceable at invocation, and chain totals. Use it to compare routes or budget a multi-model pipeline; nothing is invoked or charged.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
stepsYesSteps in execution order.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed16 schema fields changedv0.1.1
    • addedInput schema / additionalProperties
      Added value: +false
    • addedInput schema / properties / steps / description
      Added value: +"Steps in execution order."
    • addedInput schema / properties / steps / items / additionalProperties
      Added value: +false
    • addedInput schema / properties / steps / items / properties / est_input_tokens / description
      Added value: +"Expected prompt tokens for this step."
    • addedInput schema / properties / steps / items / properties / est_input_tokens / minimum
      Added value: +0
    • changedInput schema / properties / steps / items / properties / est_input_tokens / type
      Previous value: -"number"New value: +"integer"
    • addedInput schema / properties / steps / items / properties / est_output_tokens / description
      Added value: +"Expected completion tokens for this step."
    • addedInput schema / properties / steps / items / properties / est_output_tokens / minimum
      Added value: +0
    • changedInput schema / properties / steps / items / properties / est_output_tokens / type
      Previous value: -"number"New value: +"integer"
    • addedInput schema / properties / steps / items / properties / offering / description
      Added value: +"Concrete offering as \"node_id/offering_id\". Give this or `select`."
    • addedInput schema / properties / steps / items / properties / select / additionalProperties
      Added value: +false
    • addedInput schema / properties / steps / items / properties / select / description
      Added value: +"Pick the best-ranked offering matching these filters (same as search_offerings). Give this or `offering`."
    • addedInput schema / properties / steps / items / properties / select / properties
      Added value: +{
      +  "family": {
      +    "description": "Model family or exact artifact, e.g. \"llama-3.3\" or \"qwen3\". Matches model.family or model.artifact exactly.",
      +    "type": "string"
      +  },
      +  "lang": {
      +    "description": "Language with minimum grade, \"<iso-code>[:basic|strong|native]\", e.g. \"pl:strong\" or \"de\".",
      +    "type": "string"
      +  },
      +  "max_input_price": {
      +    "description": "Maximum input price in USD per million tokens.",
      +    "minimum": 0,
      +    "type": "number"
      +  },
      +  "min_context": {
      +    "description": "Minimum context window in tokens, e.g. 32768.",
      +    "minimum": 1,
      +    "type": "integer"
      +  },
      +  "modality": {
      +    "description": "What the model consumes/produces. Use \"text\" for chat and completion models.",
      +    "enum": [
      +      "text",
      +      "image",
      +      "audio",
      +      "video",
      +      "embedding",
      +      "multimodal",
      +      "agent"
      +    ],
      +    "type": "string"
      +  },
      +  "q": {
      +    "description": "Free-text match against the model metadata, offering id, and node id, e.g. \"bielik\" or \"coder\".",
      +    "type": "string"
      +  },
      +  "scheme": {
      +    "description": "Payment scheme the offering must accept. \"free\" finds no-cost offerings.",
      +    "enum": [
      +      "free",
      +      "prepaid",
      +      "x402"
      +    ],
      +    "type": "string"
      +  },
      +  "supports": {
      +    "description": "Comma-separated features the offering must all support: tool_calls, json_mode, vision, streaming. Example: \"tool_calls,json_mode\".",
      +    "type": "string"
      +  },
      +  "tier": {
      +    "description": "Minimum trust tier. unverified < community (passed automated checks) < verified (identity and context verified) < attested.",
      +    "enum": [
      +      "unverified",
      +      "community",
      +      "verified",
      +      "attested"
      +    ],
      +    "type": "string"
      +  }
      +}
    • addedInput schema / properties / steps / items / required
      Added value: +[
      +  "est_input_tokens",
      +  "est_output_tokens"
      +]
    • addedInput schema / properties / steps / maxItems
      Added value: +20
    • addedInput schema / properties / steps / minItems
      Added value: +1
  2. First observedv0.1.0

TDQS

A4.3/5.0
Behavior4/5

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

Annotations already declare readOnly/idempotent/openWorld, so the bar is lower, yet the description adds real value: it states what is returned (per-step cost bounds in USD, the pinned card_revision, chain totals) and guarantees no invocation or charge. This is genuine behavioral context beyond the structured fields.

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?

Front-loaded with the key frame ('Pre-price an invocation chain BEFORE spending money') and three dense sentences that each carry information (step forms, return contents, usage). Slightly packed but nothing is wasted.

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?

No output schema, but the description compensates by naming the return payload (cost bounds, card_revision, totals) and the enforceability of the estimate. For a one-parameter nested tool this covers what an agent needs to call and interpret it, leaving only minor details like chain-size limits unstated.

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

Parameters4/5

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

Schema coverage is 100% (baseline 3), but the description adds conceptual meaning: each step is either a concrete offering or a `select` query that picks the best-ranked match, plus expected input/output tokens. This explains the dual-mode `steps` structure better than the schema alone, and ties `select` to search_offerings semantics.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource: 'pre-price an invocation chain BEFORE spending money,' with the scope (chain, not single offering) and the two step forms made explicit. An agent can distinguish this cost-estimation tool from search_offerings/get_offering without opening either schema.

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

Usage Guidelines4/5

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

Gives clear when-to-use: 'compare routes or budget a multi-model pipeline,' and notes the safety condition ('nothing is invoked or charged'). It references search_offerings implicitly ('same as search_offerings') but does not name a specific alternative for actually invoking the chain, so no explicit when-not routing.

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