Skip to main content
Glama

Token Estimator

dev_token_estimator

Estimate how many tokens a text consumes for each major model family (GPT, Claude, Gemini, Llama, DeepSeek) using a character/word heuristic that is within ~10% of real BPE tokenizers — enough for context budgeting and cost math, with zero dependencies. Use this when an agent needs to approximate token counts per LLM family, ±10%. x402 price $0.01/call (USDC, eip155:8453).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textYesText

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.1/5.0
Behavior4/5

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

With no annotations, the description carries the burden and does well: it discloses the method (character/word heuristic), the accuracy bound (±10% of real BPE tokenizers), that no dependencies are required, and the paid x402 cost of $0.01/call. The only gap is that it does not say what the response object looks like (per-family counts, units), and no output schema exists to cover that.

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 core action and the accuracy caveat before the commercial details. It is a single dense sentence with mild marketing filler ('with zero dependencies') and pricing metadata that, while useful, could be separated, but nothing is redundant.

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 one-parameter estimator with no annotations and no output schema, the definition covers method, accuracy, cost, and the model families returned. It falls short only on describing the shape of the returned per-family token map, which an agent might want before parsing.

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% and there is a single required parameter, so the schema already documents the input. The description only implies a single text payload ('a text') and adds no format, size-limit, or encoding guidance beyond that — baseline 3 is appropriate.

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 ('Estimate how many tokens a text consumes') scoped per model family (GPT, Claude, Gemini, Llama, DeepSeek), which distinguishes it from siblings like dev_llm_cost_calculator and dev_text_chunker. An agent can identify the operation without opening the 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?

Explicitly says to use it 'when an agent needs to approximate token counts per LLM family, ±10%' and names the target tasks (context budgeting, cost math). However, it never states when NOT to use it — e.g., that dev_llm_cost_calculator should be preferred for actual cost computation or that exact BPE tokenizers exist — so the routing guidance is incomplete.

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.

Resources