Skip to main content
Glama

Estimate tokens by character count

demo_estimate_tokens
Read-onlyIdempotent

Measures the token count of supplied text with a simple character-based estimator so results match the savings reported by manifest building and format comparison.

Instructions

Counts the tokens in a text you supply using the estimator this package ships — character count divided by four, floored — so its numbers are directly comparable with the savings reported by build_tool_manifest and compare_formats. ...

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textYesThe exact text to measure; whitespace and characters outside ASCII count toward the total like everything else.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
biasYesWhere this estimate is wrong, and by how much.
charsYesCharacter length of the submitted text.
methodYesHow the number was produced, stated plainly.
estimated_tokensYesThe figure itself: characters divided by four.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.7.14

TDQS

A4.2/5.0
Behavior4/5

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

Annotations already declare readOnly, idempotent, non-destructive, and closed-world, so the safety profile is covered. The description adds genuine behavioral value by disclosing the exact estimator (character count divided by four, floored) and its consistency guarantee, which the agent couldn't infer from annotations.

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 action and method in a single efficient sentence. Minor deduction for the trailing ellipsis and for packing the comparability rationale into the same long clause rather than separating it.

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

Completeness5/5

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

For a one-parameter, read-only, idempotent estimator with a full output schema, the description supplies everything needed: what it counts, how it counts, and why the result is comparable to sibling tools. Return values are covered by the output schema, so nothing essential is missing.

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 parameter already documents that whitespace and non-ASCII characters count toward the total. The description adds no parameter-level meaning beyond restating "text you supply," so the baseline of 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?

States a specific verb+resource ("Counts the tokens in a text you supply") and immediately qualifiers it with the estimator used. It distinguishes itself from siblings by naming build_tool_manifest and compare_formats, so an agent can tell why this tool exists alongside them.

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?

It gives clear context for use: the numbers are meant to be comparable with savings reported by build_tool_manifest and compare_formats, implying it is the verification/consistency tool. However, it never states when-not to use it or names a direct alternative to prefer, so it stops short of fully explicit routing.

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