Skip to main content
Glama

count-tokens

Estimate the token count of a text (to budget LLM calls). High volume. input=text. [x402: 0.001 USDC on Base, pay-per-use]

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": {
      "input": "<input>"
    },
    "name": "count-tokens"
  }
}

Input Schema

NameRequiredDescriptionDefault
inputYesText to measure

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedInput schema / properties / input / description
      Previous value: -"texto a medir"New value: +"Text to measure"
  2. First observed

TDQS

B3.4/5.0
Behavior3/5

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

No annotations are supplied, so the description carries the burden. It usefully discloses that the result is an 'Estimate' rather than an exact count, and adds the payment terms ('0.001 USDC on Base, pay-per-use') — real context an agent needs before invoking. It does not say which tokenizer/model the estimate assumes or what the response looks like, which for an unannotated tool is a meaningful omission.

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?

Very short and front-loaded: purpose, then use case, then volume, then cost. The 'input=text' fragment is redundant with the schema and the bracketed pricing block is terse to the point of being noisy, but nothing is padded.

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

Completeness3/5

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

For a one-parameter, no-output-schema utility this covers the essentials: purpose, estimation vs. exactness, throughput, and price. It still leaves open which model's tokenizer is assumed and how the count is surfaced, gaps an unannotated tool should close.

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 coverage is 100% and the single 'input' property is already documented as 'Text to measure'. The phrase 'input=text' merely restates the schema and adds no format, size-limit, or encoding guidance.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource: 'Estimate the token count of a text,' with the purpose ('to budget LLM calls') attached. It does not distinguish itself from the near-identical sibling 'contar-tokens', so an agent cannot route between them from the text alone.

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

Usage Guidelines3/5

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

The parenthetical 'to budget LLM calls' and 'High volume' imply when this tool is appropriate (cheap pre-flight budgeting), but there is no explicit when-not guidance and no named alternative for exact counting.

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.