Skip to main content
Glama
ankit-aglawe

tokencost-mcp-server

Estimate Token Cost

tokencost_estimate_cost
Read-onlyIdempotent

Calculate token usage costs for AI models by specifying model, input tokens, and output tokens to get a detailed cost breakdown in USD.

Instructions

Calculate the cost for a specific number of input and output tokens with a given model.

Args:

  • model (string): Model ID or name

  • input_tokens (number): Number of input tokens (0 to 100B)

  • output_tokens (number): Number of output tokens (0 to 100B)

Returns: Cost breakdown with input cost, output cost, and total cost in USD.

Examples:

  • model="gpt-5", input_tokens=1000, output_tokens=500 → Cost for a typical API call

  • model="claude-sonnet-4.6", input_tokens=100000, output_tokens=4000 → Cost for a long context call

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
modelYesModel ID or name
input_tokensYesNumber of input tokens
output_tokensYesNumber of output tokens
Behavior3/5

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

Annotations already declare readOnlyHint=true, destructiveHint=false, idempotentHint=true, and openWorldHint=false, covering safety and idempotency. The description adds value by specifying the return format ('Cost breakdown with input cost, output cost, and total cost in USD') and providing examples, but does not disclose additional behavioral traits like rate limits or error conditions.

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?

The description is well-structured with clear sections (purpose, Args, Returns, Examples) and front-loaded key information. It is appropriately sized, though the examples could be slightly more concise. Every sentence adds value without redundancy.

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?

Given the tool's moderate complexity (3 parameters, no output schema), the description is mostly complete. It covers purpose, parameters, returns, and examples. However, it lacks explicit usage guidelines against siblings and does not detail output structure beyond a high-level description, leaving some gaps for an agent.

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%, with each parameter clearly documented in the schema. The description adds minimal value beyond the schema by listing parameters in the Args section and providing examples, but does not explain semantics like token ranges or model formats beyond what the schema already states.

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?

The description clearly states the tool's purpose with a specific verb ('Calculate') and resource ('cost for a specific number of input and output tokens with a given model'). It distinguishes from siblings like 'compare_models' or 'find_cheapest' by focusing on cost estimation for a single model rather than comparison or optimization.

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?

The description provides clear context for when to use this tool (to calculate token costs for a model), but it does not explicitly state when not to use it or name alternatives. Sibling tools like 'compare_models' or 'find_cheapest' are implied alternatives for different use cases, but no explicit guidance is given.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ankit-aglawe/tokencost-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server