Skip to main content
Glama

Run Several Queries at Once

batch
Read-onlyIdempotent

Runs several read-only code queries in one round-trip on a shared session, returning each result or error so independent questions can be answered together.

Instructions

Run several read-only query tools in ONE round-trip against one shared session. measure sizes each answer instead of returning it.

Use it for questions independent of each other's answers; a solution path as sessionId is analyzed once.

queries: an array of {tool, args}; args: that tool's own arguments as a JSON object WITHOUT sessionId (omit args 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 | omitted}], count, okCount, omittedCount (when any) }, in query order. A failing sub-query answers ok:false + error; the rest still return. A JSON tool's result nests as an object, a Markdown tool's as a string. The answers share ~9000 tokens, small ones whole first. A large answer is never cut: a 'budget' tool's may render smaller if its share reaches the tool's floor (see 'note'), else it carries 'omitted' (it ran; call it directly). Unknown arguments are ignored, named in 'note'.

Dispatchable: a fixed registry of read-only code queries, among them find_*/get_*/impact_of_change/symbol_signature/explain_symbol/calls_external/resolve_injection/symbol_metrics/list_insights. Refused per item, with the names the active profile dispatches listed: tools that mutate session state or write (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 - call these directly where exposed. A tool the active MCP profile does not expose is refused too, as a direct call would be.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "sessionId": "<sessionId>",
      "queries": "<queries>"
    },
    "name": "batch"
  }
}

Input 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.8/5.0
Behavior5/5

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

Beyond the annotations, the description discloses the maximum batch size, whole-call failure cases, partial-failure behavior, result ordering, shared token budget, omission behavior for large answers, and unknown-argument handling. These are substantial behavioral details not supplied by the annotations.

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?

The description is front-loaded with purpose and organized around usage, query structure, return behavior, and refused tools. It is dense but appropriate for a complex batching tool, though some sentences such as 'measure sizes each answer instead of returning it' are harder to parse than necessary.

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?

For a complex two-parameter batching tool with no output schema, the description covers input shape, dispatch constraints, failure semantics, return shape, budget behavior, and refusal categories. An agent has enough information to invoke it correctly and interpret partial results.

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 schema already documents both parameters, including that sessionId is shared and args omit sessionId. The description still adds useful meaning through a concrete query example, the omit-args rule for no-argument tools, and the batch limit, though it does not add much beyond the schema's own descriptions.

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?

The description states a specific operation: running several read-only query tools in one round-trip against a shared session. It clearly distinguishes batching from direct calls and names the dispatchable registry, so an agent can identify the tool's role 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?

It explicitly says to use this for questions independent of each other's answers, notes that a solution path passed as sessionId is analyzed once, and explains that mutation, state-changing, and poor-fit tools are refused and should be called directly. That is clear when-to-use and when-not-to-use guidance with alternatives.

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