Skip to main content
Glama

Model Ruler — AI Cost Calculators

token-counter

Use when a user asks how many tokens a given text will consume, or needs to estimate prompt size before pricing a workload. Given text and tokenizer family, returns low/high token range and byte-level measurements.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textYesText content to count tokens for
tokenizerNoTokenizer family (default: default)
expected_out_tokensNoExpected output token budget (optional)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4/5.0
Behavior3/5

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

No annotations, so the description carries the burden. It usefully discloses the output shape (range plus byte measurements), but says nothing about determinism, approximate-vs-exact counting, or which tokenizer is assumed by 'default' — gaps for a tool with zero annotation coverage.

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

Conciseness5/5

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

Two sentences, zero waste, front-loaded with the triggering condition before the behavior. Every clause earns its place.

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 three-parameter, no-output-schema tool, the description covers both when to call it and what it returns, which is sufficient to invoke correctly. The only missing piece is tokenizer-selection guidance among the seven enum values.

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 the schema already documents all three parameters including the tokenizer enum. The description only echoes 'text and tokenizer family' and ignores expected_out_tokens, adding no syntax or semantics beyond the schema.

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+resource (counts tokens for given text) and quantifies the return ('low/high token range and byte-level measurements'). It is clearly a measurement primitive, distinguishable from the sibling cost/planning calculators.

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 explicit trigger conditions ('when a user asks how many tokens... or needs to estimate prompt size before pricing a workload'). It does not name alternative tools or when NOT to use it, but the intended context is unambiguous.

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