Skip to main content
Glama

token_count

Read-only

Estimate LLM token usage for text, a file, or a folder against a budget, including per-extension totals and largest files.

Instructions

Estimate LLM tokens of text, a file or folder vs a budget; per extension and largest files.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "token_count"
  }
}

Input Schema

NameRequiredDescriptionDefault
topNo
pathNofile or folder
textNo
budgetNodefault 200000
extensionsNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.4.2

TDQS

A3.5/5.0
Behavior3/5

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

Annotations already declare readOnlyHint=true, so the safety profile is covered. The description adds genuinely new behavioral information about the output shape (per-extension breakdown, largest files) and the budget comparison, but says nothing about how the estimate is computed, precision, or what the top-N behavior does; with no output schema, that gap matters.

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?

A single dense sentence, front-loaded with the core capability and then the breakdown options after the semicolon. Efficient, only slightly telegraphic in the phrase 'vs a budget'.

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

Completeness3/5

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

With 5 optional parameters, no output schema, and partial schema descriptions, the definition covers the capability but leaves the meaning of 'top', mutual exclusivity of text vs path, and the returned structure underspecified. Adequate to attempt a call, not to predict its output.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is only 40%, yet the description supplies meaning for path (file or folder), text, budget, and the extensions breakdown. The 'top' parameter is never explained, which is the one real remaining hole.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description names a specific verb (Estimate) and resource (LLM tokens of text, a file or folder), and adds the comparison axis (vs a budget) plus the breakdown dimensions (per extension, largest files). That is enough to separate it from siblings like calc or disk_usage, though no sibling is named explicitly.

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 phrase 'vs a budget' implies the intended scenario (checking whether content fits a model context window), but the description never states when to prefer this over other tools or what happens with each input mode. Usage is inferable rather than instructed.

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