Skip to main content
Glama

Measure Answer Sizes

measure
Read-onlyIdempotent

Calculate the exact token count a read-only query would return without fetching the answer, to decide if the call is worth making, what budget to set, or whether to narrow scope.

Instructions

Report how BIG a read-only query's answer would be - its exact token count - WITHOUT returning the answer. Use it to decide before you pull: whether a call is worth making, what 'budget' to pass a slice tool (get_context/explain_symbol/pack_for_task), or whether to narrow 'scope' first. Same shape as batch: pass the shared session_id once plus 'queries', an array of {tool, args} where 'args' is that tool's own arguments WITHOUT the sessionId. Example: queries=[{"tool":"explain_symbol","args":{"symbol":"OrderService","include":["callees"]}}] → {tool, ok, tokens, chars, returned, totalFound, truncated, budgetNote}. 'tokens' is the real tokenizer count (cl100k_base) of the exact text the tool would return; 'returned/totalFound/truncated' are passed through when the tool answers with a capped envelope, so you also see whether you would be seeing everything. The Markdown slice tools (get_context / explain_symbol / pack_for_task) have no such envelope - they disclose budget pruning in prose, so 'budgetNote' carries that disclosure verbatim: if it says types were dropped, the answer you are pricing is already CUT (an axis you asked for can be missing entirely), and a larger 'budget' is what buys it back. IMPORTANT: measure does NOT make the query cheaper to RUN - the server does the full work either way; it makes the answer cheap to INSPECT (you pay ~50 tokens instead of the answer). So measure to DECIDE, then call once - do not measure every call by reflex. Dispatches the same read-only tools as batch, and refuses the same ones for the same four reasons - mutation is only the first of them; the refusal message names which one applies. Like batch, sub-queries follow the ACTIVE POOL: an out-of-pool tool is refused per item. Max 16 queries per call.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queriesYesThe read-only queries to measure: an array of { tool, args } objects, exactly as for batch. Max 16.
sessionIdYesThe session_id returned by analyze_solution. Also takes an absolute .sln/.slnx/.slnf path, analyzed on first use. Shared by ALL queries - do NOT repeat it inside each query's args.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.5.46513
    • changedInput schema / properties / sessionId / description
      Previous value: -"The session_id returned by analyze_solution (or an absolute .sln path to self-init once). Shared by ALL queries - do NOT repeat it inside each query's args."New value: +"The session_id returned by analyze_solution. Also takes an absolute .sln/.slnx/.slnf path, analyzed on first use. Shared by ALL queries - do NOT repeat it inside each query's args."
  2. First observed

TDQS

A4.6/5.0
Behavior4/5

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

Annotations already cover the safety profile (readOnly, idempotent, non-destructive), but the description adds substantial context beyond them: it does not reduce query execution cost, it costs ~50 tokens instead of the full answer, it enforces a 16-query cap, it follows the active pool, and it refuses the same tools as batch for four named reasons. The only minor gap is that it doesn't detail per-item failure semantics beyond 'the refusal message names which one applies'.

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?

Dense and front-loaded – the core 'token count without the answer' claim and the decide-then-call usage rule come first, followed by mechanics. It is long, and the 'Max 16 queries per call' statement duplicates the schema description, but nearly every sentence carries information an agent needs.

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?

There is no output schema, yet the description fully specifies the return payload ({tool, ok, tokens, chars, returned, totalFound, truncated, budgetNote}) and explains the semantics of the ambiguous fields, including how budgetNote surfaces prose-level budget pruning. An agent has everything needed to call and interpret this tool.

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 100%, so the baseline is 3, but the description goes further: it clarifies that sessionId is shared once and must NOT be repeated inside each query's args, describes the {tool, args} item shape, and supplies a worked example with real args. That is meaningfully more than the schema provides.

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 precise verb+resource: it reports the exact token count of a read-only query's answer without returning it. It explicitly distinguishes itself from sibling batch ("Same shape as batch") and from the actual answering tools it prices, so an agent can route correctly without opening any schema.

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

Usage Guidelines5/5

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

Gives concrete when-to-use conditions (decide whether a call is worth making, what budget to pass get_context/explain_symbol/pack_for_task, whether to narrow scope first) and an explicit when-not ("measure to DECIDE, then call once - do not measure every call by reflex"). It also explains what it refuses and why, which is strong alternative-routing guidance.

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