Token Diet
Server Details
Count tokens exactly for any text and see if it fits a 128K, 200K or 1M context window.
- Status
- Healthy
- Last Tested
- Transport
- Streamable HTTP · MCP 2025-11-25
- URL
TDQS
Scored across 1 tool
There is only one tool, so there is nothing to confuse it with. The description also explicitly scopes it ('Not for shortening text') and states when to use it versus estimating, eliminating ambiguity.
The single tool uses clear snake_case with a server prefix (tokendiet_count_tokens), matching a verb_noun pattern. No conflicting conventions exist, so naming is fully predictable.
Token counting is a narrow, single-purpose utility, so one focused tool is a reasonable scope rather than an extreme mismatch. It could arguably be slightly richer (e.g. encoding selection), but nothing feels bloated or missing structurally.
The tool covers the core need: exact token counts, word/char counts, and per-window usage, plus model-family caveats. Minor gaps exist, such as no selectable encoding/tokenizer or multi-text batch mode, but agents can work around them.
Available Tools
1 tooltokendiet_count_tokensCount the exact tokens in a textARead-onlyIdempotentInspect
Use when the user asks how many tokens a text, prompt, log, document or code paste is, whether it fits a context window (128K, 200K, 1M), or how big something is before they send it to an AI. Returns the exact o200k token count (GPT-4o family and later; Claude and Gemini usually within about 15%), plus words, characters and how much of each window it uses. Language models cannot count their own tokens, so call this instead of estimating. Example: {"text": ""}. Not for shortening text.
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | The text to count (up to 200,000 characters). |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Goes well beyond the readOnly/idempotent annotations: it discloses the tokenizer (o200k, GPT-4o family and later), the expected accuracy for Claude and Gemini (~15% variance), the full set of returned metrics (tokens, words, characters, window utilization), and the 200K character ceiling. This is exactly the accuracy-caveat context an agent needs to relay results honestly.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Front-loaded with the trigger condition, then the return shape, then the justification for not estimating, then the exclusion. Dense but every sentence carries decision-relevant information; nothing is padding.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a single-parameter read-only counting tool with no output schema, the description covers trigger, tokenizer, accuracy caveats, returned fields, and input limits. An agent could invoke and correctly report results with no further information.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100% and the single `text` parameter is already documented with its 200,000-character limit, so the schema does the heavy lifting. The description's JSON example merely restates the schema shape rather than adding syntax or formatting rules, so the baseline 3 is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
States a specific verb and resource (count tokens in a text) and enumerates the exact input classes it covers: text, prompt, log, document, code paste. It also carves out what it is not ("Not for shortening text") and names the specific tokenizer used, so the tool is unambiguous even without siblings.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Gives an explicit trigger ("Use when the user asks how many tokens..."), a proactive condition (checking fit against 128K/200K/1M context windows before sending), and a clear exclusion ("Not for shortening text"). It also says to call this *instead of estimating*, which preempts the most likely competing behavior.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
2 tool updates
- Added
tokendiet_count_tokens - Removed
tokendiet_trim_text
1 tool update
- First observed
tokendiet_trim_text
Related MCP Connectors
Count tokens (o200k/cl100k), truncate to a budget, chunk text for RAG and estimate LLM cost.
Counts tokens under OpenAI-compatible (tiktoken) encodings, by model or encoding name.
Token counting, RAG chunking, truncation, HTML to Markdown and JSON repair
Exact Claude API cost calc with real cache economics, plus a tiktoken-misuse scanner.
Related MCP Servers
- AlicenseAqualityDmaintenanceEstimates Claude API token counts, per-model cost, and prompt-caching break-even without an API key or network.5MIT
- FlicenseNot gradedqualityCmaintenanceAccurately counts characters, bytes, and manuscript paper based on Unicode grapheme clusters, and provides deterministic feedback to help AI meet exact length limits for self-introductions or school records.-
- AlicenseAqualityDmaintenanceLets Claude Desktop, Cursor, Cline, Windsurf, Zed, or any other MCP client estimate token counts and fit a chat history into a model's context budget on demand.339 npm1MIT
- AlicenseNot gradedqualityDmaintenanceProvides tools to count tokens, estimate API costs, optimize prompts, and compare AI model pricing for multiple LLMs.59 npmMIT
Glama MCP Gateway
Add one secure layer between your agents and this server.