Skip to main content
Glama
mcp-server-repo-context

mcp-server-repo-context

estimate_tokens

Estimates how many LLM tokens a file or directory will consume before loading it, helping you budget context and avoid oversized reads.

Instructions

Estimate how many LLM tokens a file or directory would cost before you load it.

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": "estimate_tokens"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathNoFile or directory, default repo root
excludeNoGlob patterns to exclude
includeNoGlob patterns to include, e.g. ['*.py', 'src/**']

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.5/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 full behavioral burden. It implies a non-mutating, read-like inspection, but says nothing about whether the estimate is approximate, whether it reads file contents or just sizes them, or how ignored/hidden files are treated. These omissions matter for interpreting the number.

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 sentence with zero filler, and the core verb and resource are front-loaded before the usage cue. Nothing is wasted.

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?

The tool is simple (3 optional params, no output schema), and the description covers its intent adequately. It stops short of saying what the result looks like — a single count versus a per-file breakdown — which is the remaining gap an agent would care about with no output schema present.

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 'path', 'exclude', and 'include' are already documented with examples in the schema. The description only adds that 'path' may be a file or directory, which the schema already covers, so baseline 3 applies.

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?

States a specific verb ('estimate') and resource ('LLM tokens') scoped to a file or directory, which is clearly distinct from siblings like read_file or repo_tree. It doesn't explicitly name an alternative, but the action is unambiguous.

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 'before you load it' implies the intended moment of use as a pre-flight cost check, which is useful context. However, it offers no explicit when-not guidance and doesn't name which sibling to use instead once the estimate is acceptable.

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