Skip to main content
Glama

terse_tokens

Count tokens of Terse source code using tiktoken cl100k_base; fall back to a ceil(len/4) estimate if tiktoken is unavailable.

Instructions

Count tokens of Terse source with tiktoken cl100k_base; falls back to a ceil(len/4) character estimate when tiktoken is unavailable.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sourceYesTerse source code to measure.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A3.8/5.0
Behavior4/5

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

With no annotations, the description carries the full burden, and it does disclose two behaviorally important facts: the exact encoding used and a deterministic fallback (ceil(len/4)) when tiktoken is unavailable, which directly affects result accuracy. It does not mention performance or that results are approximate in fallback mode in absolute terms, but the key correctness caveat is present.

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?

A single tight sentence that front-loads the primary behavior (tiktoken cl100k_base) before the fallback caveat. Every clause earns its place, no filler.

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 one-parameter, annotation-free, no-output-schema tool, the description covers purpose, encoding, and a fallback path. The only minor gap is that it does not state that the return value is a single integer count, though 'Count tokens' strongly implies 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 single 'source' parameter is already fully documented in the schema. The description adds no syntax, size limits, or format detail beyond restating that the input is Terse source, so the baseline 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 (count tokens) and resource (Terse source) and even names the exact tokenizer (tiktoken cl100k_base). This is unmistakably distinct from the parse/transpile/eval/alias siblings.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

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

No when-to-use guidance is offered — nothing about why an agent would count tokens (context budgeting, cost estimation) or any alternative for measuring size. Usage must be inferred entirely from the tool name and purpose.

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