Skip to main content
Glama

Search agent memory with several queries at once

memory_search_batch
Read-onlyIdempotent

Answer several questions against one agent's memory in a single concurrent call and get a deduplicated merged result, avoiding separate searches and extra round trips.

Instructions

Answer SEVERAL questions against one agent's memory in a single call, run concurrently. Use it whenever you hold more than one open question; use memory_search when you have exactly one. Put EVERY open question into ONE call: queries run in parallel server-side and splitting them costs a model round trip each. A query may come back with a weak-match note naming nearby vocabulary: reformulate those once with the suggested terms; lasting synonyms belong in memory_alias. Returns merged, a deduplicated best-first block ready to read where a fact answering several queries appears once, plus per_query for the individual lists. Ranking per query is identical to calling memory_search alone; this changes how many turns you spend, not what comes back.

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": {
      "agent_id": "<agent_id>",
      "queries": "<queries>"
    },
    "name": "memory_search_batch"
  }
}

Input Schema

NameRequiredDescriptionDefault
top_kNoOptional cap on facts returned per query. Omitted or non-positive uses the store default.
queriesYesThe natural-language queries to answer, one per open question. Word each as you would for a single search; they are ranked independently and merged.
agent_idYesStable agent identifier, e.g. "graymatter-backend". Pass "__shared__" for project-wide memory.
min_confidenceNoOptional minimum effective confidence, applied before ranking and top-k. Legacy empty labels are inferred; unknown historical labels are unverified. Any explicit filter suppresses graph hints without receipts.
confidence_weightNoOptional finite preference weight in [0,0.5], default zero during opt-in rollout. Final score = base RRF * (1 + weight*c), c=1 verified, 0 inferred, -1 unverified. Zero retains an explicit filter.

Output Schema

NameRequiredDescriptionDefault
countYes
mergedYes
agent_idYes
per_queryYes
retrievalNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.21.0

TDQS

A4.7/5.0
Behavior5/5

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

Annotations only declare the safe read-only/idempotent profile; the description adds genuinely new behavior: server-side parallel execution, per-query ranking identical to memory_search, deduplicated best-first `merged` output with `per_query` lists, and weak-match notes that name nearby vocabulary. It also clarifies the guarantee that batching changes turn count, not results.

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?

Front-loads the core action and the single-vs-multiple decision, then layers batching rationale, weak-match recovery, and return semantics in a tight sequence. No filler sentences; each clause carries information an agent needs at call time.

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 5-parameter tool with an output schema, the definition covers selection criteria, batching strategy, degraded-result recovery, and ranking equivalence to the single-query sibling. Nothing needed to invoke it correctly is missing, and return-value explanation is kept brief since the output schema exists.

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 queries, agent_id, top_k, min_confidence and confidence_weight are already documented, and the description adds no syntax or format detail beyond restating that queries are ranked independently then merged. Baseline 3 applies since the schema carries the parameter meaning.

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: answer several questions against one agent's memory in a single concurrent call. It explicitly contrasts scope with the sibling memory_search ("use memory_search when you have exactly one"), so an agent can pick between them without opening either 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 explicit when-to-use (more than one open question, not exactly one) plus a strong operational directive: put every open question into one call because queries already run in parallel server-side. It also covers the follow-up path, telling the agent to reformulate a weak match once using suggested nearby vocabulary and to persist lasting synonyms via memory_alias.

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