Skip to main content
Glama

extract_memories

Extract structured preferences, facts, and skills from conversation text using rule-based or semantic LLM modes, with optional auto-save and fallback reporting.

Instructions

Extract structured memories from conversation text. mode="rule" (default) detects preferences, facts, and skills via keyword pattern matching. mode="llm" instead understands the full context (optionally pairing assistant_text) semantically — uses the configured LLM extraction provider, and degrades to rule-based extraction (reported via fallback_used/fallback_reason) when no provider is configured or the LLM call fails. Returns extracted items; with auto_save=true it also writes them and requires agent auth when the agent has a registered key. Invalid occurred_at is an error, never a silent drop.

Input Schema

NameRequiredDescriptionDefault
modeNoExtraction mode: "rule" (default, keyword pattern matching) or "llm" (semantic extraction over the full context; uses the configured LLM extraction provider, falling back to rule-based when none is configured or the LLM call fails — see fallback_used in the result).
textYesText to extract memories from (conversation content, e.g. the user's turn)
api_keyNoAPI key for agent authentication (required if agent has a registered key)
agent_idNoAgent ID to attribute saved memories tounknown
auto_saveNoWhether to auto-save extracted memories
occurred_atNoWhen the extracted facts actually happened in the source conversation (RFC 3339), stored as `occurred_at` on saved memories — distinct from `created_at` (ingestion time). Invalid input is an error, never a silent drop.
assistant_textNoOptional paired assistant/response text for mode="llm" — passing both sides of the exchange lets the model resolve references and implicit preferences a single text can't.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.9/5.0
Behavior4/5

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

Goes well beyond the annotations by disclosing the fallback path (degrades to rule-based, surfaced via fallback_used/fallback_reason), the auth requirement when an agent key is registered, and that invalid occurred_at errors rather than silently dropping. It does not address non-idempotency (idempotentHint=false) — nothing warns that repeated calls with auto_save=true may produce duplicate memories.

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 but front-loaded: purpose first, then the mode distinction, then the write/auth caveat, then the occurred_at rule. Each sentence carries information, though the mode explanation partially duplicates the schema and could be trimmed.

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 7-parameter, non-idempotent tool with no output schema, the description covers the decisions that matter: mode selection, fallback reporting, auth on write, and error semantics. The only meaningful omission is duplicate/retry behavior after a save.

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 the schema already documents mode, assistant_text, api_key, and occurred_at semantics; the description largely restates these rather than adding syntax or constraints. The one genuinely additive note is the auth precondition tied to auto_save, which lifts it just to baseline rather than above.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

Opens with a specific verb + resource ("Extract structured memories from conversation text") and immediately qualifies the two operating modes, so the agent knows exactly what the tool produces. It does not name or contrast any sibling (save_memory, add_evidence), so an agent still has to infer why to extract rather than save directly.

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

Usage Guidelines4/5

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

Gives clear conditions for the key branch: rule mode for keyword matching, llm mode for semantic understanding over full context with optional assistant_text, and notes auto_save triggers a write. It stops short of saying when to pick this tool over save_memory or when extraction is unnecessary.

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