Skip to main content
Glama

Estimate the cost of a Synap call

synap_estimate_cost
Read-onlyIdempotent

Work out what a chat completion would cost on Synap from token counts, using the live price list. Use this before synap_chat_completion when budget matters, or to compare models for a job. Free, read-only, needs no API key and runs no model. Returns {model, prompt_tokens, completion_tokens, prompt_usd, completion_usd, total_usd, pricing}. It is an estimate: the real charge uses the token counts the model reports afterwards. Auto-routing ids such as "synap-v1" have no fixed price and return an error saying so.

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>",
      "prompt_tokens": "<prompt_tokens>"
    },
    "name": "synap_estimate_cost"
  }
}

Input Schema

NameRequiredDescriptionDefault
modelYesModel id exactly as returned by synap_list_models.
prompt_tokensYesTokens you will send (system + conversation). Roughly 4 characters of English per token.
completion_tokensNoTokens you expect back. Use your max_tokens for a worst case. Defaults to 0.

Output Schema

NameRequiredDescriptionDefault
noteNo
modelYes
pricingYes
total_usdYes
prompt_usdYes
prompt_tokensYes
completion_usdYes
completion_tokensYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "properties": {
      +    "completion_tokens": {
      +      "type": "number"
      +    },
      +    "completion_usd": {
      +      "type": "number"
      +    },
      +    "model": {
      +      "type": "string"
      +    },
      +    "note": {
      +      "type": "string"
      +    },
      +    "pricing": {
      +      "properties": {
      +        "completion_per_million": {
      +          "type": "number"
      +        },
      +        "prompt_per_million": {
      +          "type": "number"
      +        }
      +      },
      +      "type": "object"
      +    },
      +    "prompt_tokens": {
      +      "type": "number"
      +    },
      +    "prompt_usd": {
      +      "type": "number"
      +    },
      +    "total_usd": {
      +      "type": "number"
      +    }
      +  },
      +  "required": [
      +    "model",
      +    "prompt_tokens",
      +    "completion_tokens",
      +    "prompt_usd",
      +    "completion_usd",
      +    "total_usd",
      +    "pricing"
      +  ],
      +  "type": "object"
      +}
  2. Added

TDQS

A4.8/5.0
Behavior5/5

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

Annotations already declare readOnly/idempotent/non-destructive, but the description adds context they cannot express: the call is free, requires no API key, and runs no model. It also discloses the key caveat that the figure is an estimate and the real charge uses post-hoc model-reported token counts, plus the error behavior for auto-routing ids.

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 purpose and usage, then caveats, with no filler sentences. The only redundancy is enumerating the returned fields, which the output schema already covers and which could have been cut to tighten the paragraph.

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

Completeness5/5

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

Given three fully documented parameters, rich annotations, an output schema and a fixed closed-world scope, the description covers purpose, cost/auth behavior, estimate-vs-actual semantics and the error case. Nothing an agent needs in order to call this correctly is missing.

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%, so the baseline is 3; the description earns an extra point by tying the model parameter to a real constraint (auto-routing ids have no fixed price and error out) and framing the two token parameters as what you will send versus expect back. It adds constraint semantics the schema's per-field text does not.

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 ("Work out what a chat completion would cost on Synap from token counts, using the live price list") and immediately separates itself from the sibling that actually runs models, synap_chat_completion. An agent can classify this as a pre-flight pricing calculator without opening any schema.

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

Usage Guidelines5/5

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

Gives explicit when-to-use triggers ("before synap_chat_completion when budget matters, or to compare models for a job") and an explicit failure boundary for auto-routing ids such as "synap-v1". Both a positive condition and an exclusion are stated, leaving nothing to inference.

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.