Skip to main content
Glama

Run Several Queries at Once

batch
Read-onlyIdempotent

Run multiple independent read-only code queries in one shared-session call, returning each result or error in order so agents avoid repeated round-trips.

Instructions

Run several read-only query tools in ONE round-trip against one shared session. measure is the sibling that reports what each answer would cost instead of returning it.

Use it whenever two or more questions do not depend on each other's answers; a solution path as sessionId is analyzed once.

queries is an array of {tool, args}: args is that tool's own arguments as a JSON object WITHOUT sessionId (omit it for a tool that takes none). Example: queries=[{"tool":"find_usages","args":{"symbol":"Foo"}},{"tool":"find_tests_for","args":{"symbol":"Foo"}}]. At most 16 per call: more fails the whole call, as does a sessionId that does not resolve.

Returns { results: [{tool, ok, result | error}], count, okCount }, in query order. A failing sub-query answers ok:false + error and the rest still return. A JSON tool's result is nested as an object, a Markdown tool's is the string. The answers share a response budget of about 9000 tokens: one that no longer fits is omitted with ok:false and a pointer to call that tool directly - after its work was done. 'note' on an item names arguments the tool does not have; they are ignored, not rejected.

Dispatchable is a fixed registry of read-only queries about the analyzed code, among them find_*/get_*/impact_of_change/symbol_signature/explain_symbol/calls_external/resolve_injection/symbol_metrics/list_insights. Refused per item, with the registry's names listed - call these directly where the profile exposes them: tools that mutate session state or write (such as analyze_solution/refresh_session/apply_solution_config/save_session/remember_codebase/export_markdown/install_agent_hooks), poor batch members (evaluate_change_set/init_solution_config/prepare_task/review_context), tools needing a second session or snapshot (semantic_diff/diff_review/verify_claim/compare_with_previous) and the session, configuration and server tools. A tool the active MCP profile does not expose is refused per item too, as a direct call would be - also when a refusal's list names it.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queriesYesThe read-only sub-queries: an array of { tool, args } objects. 'tool' is a read-only tool name; 'args' is that tool's argument object (without sessionId), omittable when the tool needs no arguments. Max 16.
sessionIdYesThe session_id returned by analyze_solution. Also takes an absolute .sln/.slnx/.slnf path, analyzed on first use. Shared by ALL sub-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 sub-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 sub-queries - do NOT repeat it inside each query's args."
  2. First observed

TDQS

A4.9/5.0
Behavior5/5

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

Annotations declare readOnly/idempotent/non-destructive, but the description adds constraints they cannot convey: max 16 sub-queries (over-limit fails the whole call), an unresolved sessionId failing the whole call, per-item refusal semantics, partial success (ok:false + error while the rest still return), a ~9000-token shared response budget with omission behavior pointing to direct invocation, and the 'note' field for unrecognized args being ignored not rejected. This is rich behavioral disclosure well beyond the annotation set.

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?

Front-loaded with purpose then usage then return shape then failure modes then the dispatchable/refused registry. Dense and mostly waste-free for the surface area covered, though the sessionId-omission point is stated twice and the refused-tool list is long.

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?

No output schema exists, yet the description supplies the return shape ({results:[{tool,ok,result|error}], count, okCount} in query order), per-item vs whole-call failure behavior, and budget-driven omission semantics. For a dispatcher with a nested query registry, this is complete enough to invoke correctly.

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

Parameters5/5

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

Schema coverage is 100%, so baseline is 3, but the description adds real meaning: the required {tool, args} shape, that args must omit sessionId, a concrete worked example, the max-16 bound, and that sessionId accepts an absolute .sln/.slnx/.slnf path analyzed on first use. It goes well beyond the schema text.

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+resource: 'Run several read-only query tools in ONE round-trip against one shared session.' It also explicitly distinguishes itself from its sibling measure, which 'reports what each answer would cost instead of returning it.' An agent can tell what this does and what it is not without opening the 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?

Explicit trigger: 'Use it whenever two or more questions do not depend on each other's answers.' It also enumerates what must NOT be batched — mutating tools, poor batch members (evaluate_change_set, init_solution_config, prepare_task, review_context), tools needing a second session/snapshot, and session/config/server tools — with the registry's names. When/when-not coverage is unusually complete.

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