Skip to main content
Glama

Write an entry

memory_write

Record or update facts in shared long-term memory, keeping prior versions for undo. Search first to avoid duplicates.

Instructions

Record a new fact, or update an existing one (same scope + name updates it in place).

Search first (memory_search) to avoid creating a duplicate under a different name. An update keeps the previous version in memory_history and is logged in memory_events, so it can be undone. Updating an archived entry is refused: restore it first with memory_restore. Secret-shaped values in content (API keys, tokens, password: ... lines) are replaced by [REDACTED] before storage; if any were, the result includes "redacted": [<codes>].

Returns {"ok": true, "id": ...} on success, or {"ok": false, "error": ...} for an invalid argument, a conflict (stale expected_updated_at or archived entry) or a busy database (retry). Not available on read-only connections.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesShort kebab-case slug, unique within the scope. Reusing an existing scope + name updates that entry.
typeYesKind of fact: user (who the user is), feedback (guidance on how to work, with the reason), project (ongoing work, decisions, constraints) or reference (pointers to external resources).
scopeYesProject/topic scope the entry belongs to, e.g. a project folder name (list them with memory_scopes). On a scope-locked connection (--scope), this argument is ignored and the connection's own scope is used.
contentYesThe full memory content, Markdown allowed. Never put secrets here: secret-shaped values are redacted.
descriptionNoOne-line summary of what this entry covers, shown in search results. Truncated beyond 500 characters.
expected_updated_atNoOptional optimistic lock: the updated_at value you read with memory_get. If the entry changed since, nothing is written and a conflict error is returned. Omit to write unconditionally.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed6 schema fields changedv0.2.0
    • addedInput schema / properties / content / description
      Added value: +"The full memory content, Markdown allowed. Never put secrets here: secret-shaped values are redacted."
    • addedInput schema / properties / description / description
      Added value: +"One-line summary of what this entry covers, shown in search results. Truncated beyond 500 characters."
    • addedInput schema / properties / expected_updated_at / description
      Added value: +"Optional optimistic lock: the updated_at value you read with memory_get. If the entry changed since, nothing is written and a conflict error is returned. Omit to write unconditionally."
    • addedInput schema / properties / name / description
      Added value: +"Short kebab-case slug, unique within the scope. Reusing an existing scope + name updates that entry."
    • addedInput schema / properties / scope / description
      Added value: +"Project/topic scope the entry belongs to, e.g. a project folder name (list them with memory_scopes). On a scope-locked connection (--scope), this argument is ignored and the connection's own scope is used."
    • addedInput schema / properties / type / description
      Added value: +"Kind of fact: user (who the user is), feedback (guidance on how to work, with the reason), project (ongoing work, decisions, constraints) or reference (pointers to external resources)."
  2. First observedv0.1.0

TDQS

A4.8/5.0
Behavior5/5

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

Annotations declare non-readOnly, non-idempotent, non-destructive, but the description goes well beyond them: versioning via memory_history, event logging, undoability, archived-entry refusal, secret redaction with the `redacted` codes in the result, error classes (conflict, busy DB retry), and unavailability on read-only connections. This is exactly the behavioral layering the annotations do not provide.

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 duplicate-avoidance rule, then update side-effects, then redaction, then return/error contract. Line-broken and skimmable; slightly long, but nearly every sentence carries distinct information.

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 mutation tool with no output schema, the description supplies the success envelope ({"ok": true, "id": ...}), the failure envelope and its causes, and the read-only-connection limitation. Nothing an agent needs in order to call it correctly is missing.

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 baseline is 3, but the description adds real meaning: the scope+name update-in-place contract and the redaction behavior affecting `content`. It does not re-explain expected_updated_at, which the schema already covers well, so it stops short of a 5.

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 ('Record a new fact, or update an existing one') and clarifies the update mechanic (same scope + name updates in place). An agent can distinguish this from memory_get or memory_search without opening any 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?

Explicitly instructs to search first via memory_search to avoid duplicate names, and states the exclusion path for archived entries ('refused: restore it first with memory_restore'). Names alternatives and the conditions selecting them.

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