Skip to main content
Glama

Estimate token count

estimate_tokens

Estimate a text's token count to plan API usage and costs. Uses Claude's count_tokens endpoint when an API key is present; otherwise falls back to a character-based approximation.

Instructions

テキストのトークン数を見積もる。API キーがあれば本文を Claude API の count_tokens に送る(外部通信)。無ければ文字数ベースの概算。 / Estimate a text's token count. With an API key the text is sent to the Claude count_tokens endpoint (outbound call); otherwise a rough character-based approximation.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
langNo出力言語 / Output languageboth
textYes対象テキスト / The text to measure
Install Server

TDQS

A3.9/5.0
Behavior4/5

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

No annotations are present, so the description carries the full burden. It clearly discloses the most consequential behavior: with an API key the text is transmitted to an external Claude endpoint, and without one it uses a local approximation. This is a significant privacy and side-effect disclosure that goes well beyond the schema. It does not cover error cases or latency, but the key behavioral trait is transparently stated.

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?

The definition is compact — two bilingual sentences that state purpose and a critical behavioral caveat. The bilingual repetition doubles length but every core fact earns its place; nothing is fluff. The most important caveat (outbound call) is bolded and placed early.

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 simple two-parameter tool with no output schema, the description explains the main behavior and the fallback. It does not explicitly state the return value, but 'estimate a text's token count' reasonably implies a numeric result. Overall, an agent has enough to decide whether and how to invoke it.

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 baseline is 3. The description repeats the purpose but adds no parameter-level detail beyond the schema's own text and lang descriptions. No compensation is needed because the schema already documents both parameters.

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 opens with a specific verb and resource: 'estimate a text's token count.' It further differentiates the tool by detailing two execution modes — calling the Claude count_tokens endpoint or falling back to a character-based approximation — making its function unambiguous even without comparing sibling tools.

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 description implies the tool is for estimating token counts but gives no explicit guidance on when to prefer it over alternatives, nor when not to use it. No sibling or alternative is mentioned. The conditional API-key behavior is a usage-relevant detail but does not substitute for explicit routing guidance.

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

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Waganawa-Megumin/togaf10_EAP_MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server