Skip to main content
Glama

tokencount_estimate

Read-onlyIdempotent

Estimate token counts for text across multiple LLM tokenizers, including GPT-4, Claude, and WordPiece, to help plan prompts and manage model context limits.

Instructions

Estimate token counts for text across different LLM tokenizers (GPT-4, Claude, WordPiece).

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": {
      "text": "<text>"
    },
    "name": "tokencount_estimate"
  }
}

Input Schema

NameRequiredDescriptionDefault
textYesText to estimate tokens for.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.1.11

TDQS

A3.5/5.0
Behavior3/5

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

Annotations already declare readOnly, idempotent and non-destructive, so the safety profile is covered. The description adds useful context that results are estimates spanning multiple tokenizer families, which clarifies no per-call tokenizer selection is needed, but says nothing about result shape or accuracy limits.

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?

One front-loaded sentence with the key information — estimate, token counts, multi-tokenizer scope — and zero filler.

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?

Adequate for a simple read-only utility whose annotations and full schema coverage carry most of the load. What remains missing is whether the response contains one count per tokenizer or an aggregate, which matters when deciding whether to call it once or many times.

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% for the single 'text' parameter, so the schema does the heavy lifting and the baseline is 3. The description doesn't elaborate on input constraints such as text length limits, and pair the tokenizer list with the absence of a tokenizer parameter only implicitly.

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?

A specific verb (Estimate) plus resource (token counts) and scope (across GPT-4, Claude, WordPiece tokenizers). It is clearly distinct from near-neighbours like word_count or text_analyse, though it never names those alternatives to reinforce the distinction.

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 use case is implied by the name and description — reach for this when you need LLM token counts rather than character or word counts — but there is no explicit when-to-use or when-not statement, and no guidance on related text tools in the sibling list.

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

Deploy Server

Other Tools