Skip to main content
Glama

retrieveMemories

Semantically search stored coding memories to pre-load relevant context at session start or mid-session, returning top matches ranked by relevance, recency, and importance.

Instructions

Semantically search stored memories and return the top matches ranked by a weighted combination of relevance, recency, and importance. Read-only; no side effects.

WHEN TO CALL: (1) At the start of every session — pass the current task or file as the query to pre-load relevant context. (2) Mid-session whenever a new topic, file, or decision area arises that may have prior context. Do NOT call on every user turn.

WHEN NOT TO CALL: If you already retrieved memories for this topic this session. Use getMemory if you have a specific memoryId. Use listMemories only to audit the full store, not for context loading.

Returns up to limit results (default 20). mode='auto' is the standard startup path; mode='on-demand' signals an explicit mid-session lookup. depth='deep' runs a broader semantic sweep at higher latency — use when the topic is unfamiliar. Phrase query as what you need to recall, not what you are about to do.

NOTE: this tool updates access-pattern counters on the memories it returns (used to boost frequently-recalled memories in future ranking), so it is NOT side-effect-free despite being a lookup.

Input Schema

NameRequiredDescriptionDefault
modeNo'auto' for the standard startup context-load path. 'on-demand' for an explicit mid-session retrieval triggered by a specific task or question.auto
tagsNoOptional tag filter. When provided, only return memories that have ALL listed tags.
depthNo'default' for standard semantic search. 'deep' for a broader sweep that surfaces less-similar memories — use when the topic is new or unfamiliar.default
limitNoMaximum number of memories to return. Integer 1-100, default 20. Increase for broad topic sweeps; keep at default for focused lookups.
queryYesNatural-language description of what you need to recall. Phrase as a topic or question (e.g. 'database connection settings', 'auth flow decisions') — not an action ('store info about...').
includeHistoryNoInclude superseded facts for historical questions. Omit for current facts only.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv1.6.0
    • addedInput schema / properties / includeHistory
      Added value: +{
      +  "description": "Include superseded facts for historical questions. Omit for current facts only.",
      +  "type": "boolean"
      +}
    • addedInput schema / properties / tags
      Added value: +{
      +  "description": "Optional tag filter. When provided, only return memories that have ALL listed tags.",
      +  "items": {
      +    "maxLength": 50,
      +    "minLength": 1,
      +    "type": "string"
      +  },
      +  "maxItems": 10,
      +  "type": "array"
      +}
  2. Changed1 schema field changedv1.1.2
    • addedInput schema / properties / query / maxLength
      Added value: +1000
  3. Changed4 schema fields changedv1.0.6
    • addedInput schema / properties / depth / description
      Added value: +"'default' for standard semantic search. 'deep' for a broader sweep that surfaces less-similar memories — use when the topic is new or unfamiliar."
    • addedInput schema / properties / limit / description
      Added value: +"Maximum number of memories to return. Integer 1-100, default 20. Increase for broad topic sweeps; keep at default for focused lookups."
    • addedInput schema / properties / mode / description
      Added value: +"'auto' for the standard startup context-load path. 'on-demand' for an explicit mid-session retrieval triggered by a specific task or question."
    • addedInput schema / properties / query / description
      Added value: +"Natural-language description of what you need to recall. Phrase as a topic or question (e.g. 'database connection settings', 'auth flow decisions') — not an action ('store info about...')."
  4. First observedv1.0.0

TDQS

A3.7/5.0
Behavior1/5

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

The opening claims 'Read-only; no side effects,' which directly contradicts the readOnlyHint=false annotation. Although a later NOTE admits that access-pattern counters are updated and the tool is not side-effect-free, the definition remains internally inconsistent in a way that could mislead an agent about mutation.

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 definition is front-loaded with purpose and organized into clear WHEN TO CALL / WHEN NOT TO CALL sections. It is somewhat long and repeats schema details, and the incorrect 'Read-only; no side effects' line is wasted and harmful, but the structure is otherwise efficient.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a six-parameter retrieval tool with no output schema, it covers ranking, default result count, mode/depth usage, and alternatives well enough to call correctly. The side-effect contradiction prevents a higher score, but the schema fills in tag and includeHistory semantics.

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 all six parameters are already documented in the input schema. The description largely restates mode, depth, query phrasing, and limit behavior, with no additional syntax or edge-case guidance beyond the schema.

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 verb and resource: semantically search stored memories and return top matches ranked by relevance, recency, and importance. It distinguishes itself from siblings by naming getMemory for memoryId lookups and listMemories for store auditing.

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 gives explicit WHEN TO CALL triggers for session start and mid-session topic changes, plus WHEN NOT TO CALL conditions including avoiding repeated retrieval and not calling every user turn. It also routes specific cases to getMemory and listMemories.

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