Skip to main content
Glama

save_memory

Persist a learning note with linked SLayer entities or query, returning a memory id for later retrieval.

Instructions

Save an agent memory: a free-form note plus the SLayer entities it concerns.

linked_entities accepts either:

  • a list of entity reference strings — each item is resolved to the canonical <datasource>.<model>[.<leaf>] form. Bare names use the datasource priority list; ambiguous bare-column matches are rejected. memory:<id> is also valid here (cross-memory references; the target memory must exist).

  • a SlayerQuery (dict) — entities are auto-extracted from source_model, dimensions, time_dimensions, measures, and filters; resolution warnings are non-fatal. The query itself is stored alongside the learning, so the memory surfaces in search's example_queries list (vs the memories list for entity-list memories).

DEV-1428: id is an optional canonical memory id. Omit to auto-allocate a monotonic int-shaped id ("1", "2", ...); supply a string for a stable user-controlled id ("kb.policy.42"). Charset excludes :, /, ?, #, whitespace. Duplicate id → unconditional upsert, created_at preserved.

Returns the assigned memory_id (string), the canonical entities stored, and any non-fatal warnings.

Cascade-on-delete: when a model / datasource / measure is deleted, every memory:<id> and <ds>.<model>[.<leaf>] reference under it is automatically stripped from every other memory's entities list. Memories with zero entities after the strip are kept (the learning text stands alone).

Search is lenient: stale entity tags in saved memories are filtered out at retrieval time rather than raising.

Args: learning: The note text. Required, non-empty. linked_entities: List of entity strings, or an inline SlayerQuery payload. id: Optional canonical memory id (see above).

Examples: save_memory( learning="orders.is_returned in {0,1,NULL}; treat NULL as not returned", linked_entities=["orders.is_returned"], )

save_memory(
    learning="Paid revenue by status",
    linked_entities={
        "source_model": "orders",
        "measures": [{"formula": "amount:sum"}],
        "filters": ["status = 'paid'"],
    },
    id="kb.paid-revenue",
)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idNo
learningYes
descriptionNo
linked_entitiesYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. First observedv0.10.0

TDQS

A4.6/5.0
Behavior5/5

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

No annotations are provided, so the description carries the full burden—and it does so thoroughly. It discloses id auto-allocation and upsert semantics, charset restrictions, cascade-on-delete stripping of entity references, preservation of zero-entity memories, lenient stale-tag filtering at retrieval time, and the exact return payload. This is far beyond what a naive 'save' description would provide.

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?

The description is long, but the length is justified by the polymorphic input and complex side effects. It is front-loaded with a clear purpose, then structured into short labeled sections and examples. Nearly every sentence carries distinct behavioral or semantic information needed for correct invocation.

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?

The description is nearly complete for a tool of this complexity: return values, id behavior, search integration, cascade deletion, and examples are all covered. The main omission is the `description` parameter, and there is no explicit pointer to `forget_memory` for cleanup, though the sibling list makes that relation inferable.

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 description coverage is 0%, so the description must compensate. It richly explains `learning`, both forms of `linked_entities` (string list and SlayerQuery) with resolution rules, and `id` with allocation and upsert behavior. The one clear gap is the optional `description` property present in the schema but never mentioned in the description, leaving its semantics unexplained.

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 opens with a precise verb-resource pair: 'Save an agent memory' and immediately defines what a memory consists of (free-form note plus SLayer entities). It also differentiates the two memory forms by how they surface in search, which helps an agent distinguish this tool from read/search and forget siblings.

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?

The text gives strong contextual guidance: it explains cross-memory references, query-auto-extraction, and how memories appear in `search`'s `example_queries` vs `memories` lists. However, it never explicitly states when not to use this tool or names alternatives like `forget_memory` for deletion, so it stops short of full routing guidance.

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

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/MotleyAI/slayer'

If you have feedback or need assistance with the MCP directory API, please join our Discord server