Skip to main content
Glama

tokens_count

Counts tokens under an OpenAI-compatible (tiktoken) encoding. Provide exactly one of model (e.g. "gpt-4o") or encoding ("o200k_base" or "cl100k_base"). No Claude/Anthropic tokenizer.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textYes
modelNoe.g. gpt-4o; exactly one of model/encoding
encodingNoo200k_base or cl100k_base; exactly one of model/encoding

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
tokensYes
encodingNo

TDQS

A4.1/5.0
Behavior3/5

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

With no annotations, the description must carry the transparency burden. It discloses the compatibility boundary and the exclusive parameter requirement, but it does not describe behavior for invalid combinations (both/neither model and encoding) or tokenization nuances beyond the schema. This is adequate but not rich.

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?

The description is two sentences, tightly worded, and front-loaded with the core action. Every sentence contributes essential scope or constraint information with no redundancy.

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?

This is a low-complexity tool, and the description covers the essential input constraints, compatibility scope, and exclusions. An output schema exists, so the lack of return-value detail is not a gap.

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 67%, and the schema already includes the 'exactly one' constraint for model/encoding. The description reinforces this and adds concrete values, but it adds little meaning beyond the schema for the 'text' parameter and does not clarify edge-case semantics.

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 object ('Counts tokens') and clearly scopes the operation to OpenAI-compatible tiktoken encodings. It also explicitly excludes Claude/Anthropic tokenizers, distinguishing it from potential alternatives even in the absence of 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 Guidelines4/5

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

The description provides explicit usage constraints: provide exactly one of 'model' or 'encoding', with concrete examples. It also states when not to use it ('No Claude/Anthropic tokenizer'), though it does not name alternative tools because none are listed.

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.

TDQS

A4.3/5.0
Disambiguation5/5

With only one tool, there is no ambiguity. An agent cannot confuse it with any other tool, as there are no alternatives.

Naming Consistency5/5

The single tool 'tokens_count' uses a clear snake_case naming pattern. While there is no other tool to compare, the name is self-consistent and follows a reasonable convention.

Tool Count5/5

One tool is exactly appropriate for a focused token counter server. The tool performs a single, well-defined task that matches the server's purpose.

Completeness4/5

The tool covers the stated domain of counting tokens for OpenAI-compatible encodings. However it explicitly excludes Claude/Anthropic tokenization, which could be a gap for broader LLM token counting needs.

Resources