Skip to main content
Glama

Model Ruler — AI Cost Calculators

Token Counter

token-counter
Read-onlyIdempotent

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

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.1/5.0
Behavior4/5

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

Annotations already establish readOnly, idempotent, non-destructive, closed-world behavior, so the safety profile is covered. The description usefully adds that the result is a low/high range plus byte-level measurements rather than a single exact number, which an agent cannot learn from the annotations or schema.

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?

Two sentences, front-loaded with the usage trigger followed by the input/output summary; no filler. Slightly dense but every clause carries information.

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?

With no output schema, the description does the necessary work of describing the return (range + byte measurements) and the safety profile comes from annotations. It leaves unclear how expected_out_tokens influences the result, a minor gap for a 3-parameter tool.

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 every parameter is already documented with types, an enum, and a default. The description only echoes "text and tokenizer family" and omits any mention of expected_out_tokens, so it adds little beyond the schema. Baseline 3 applies.

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 names a specific action (count tokens for given text) and resource (text + tokenizer family), and states the return shape (low/high token range, byte-level measurements). It also draws the boundary with the sibling cost-calculator tools by framing itself as the pre-pricing sizing step.

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?

"Use when a user asks how many tokens a given text will consume, or needs to estimate prompt size before pricing a workload" gives a clear triggering context. There is no explicit when-not condition and no sibling tool is named as the alternative for adjacent cases (e.g. the cost calculators).

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