Skip to main content
Glama

edit_memory

Replace the body of an existing memory file while preserving its metadata and history. A content hash check prevents overwriting concurrent edits.

Instructions

MUTATING: replace the body of one existing curated memory file while preserving its frontmatter, address, and history. Writes to local disk and appends to the change timeline. The write is guarded: a stale expected_hash fails without changing anything and returns a structured error naming the re-read-and-retry next action, so concurrent edits cannot be lost. Read the file first to obtain the hash. Not for canonical memory about the user, which reconciliation regenerates: use pin_memory there. Not for creating a new file: use write_memory. Parameters: address identifies the file to edit; text is the complete replacement Markdown body, which overwrites rather than appends; expected_hash is the content_hash from the read that produced text; project_path project root whose memory tree the operation applies to. Omit it to use the machine-wide tree, and always omit it when this server was started pinned to a project. Returns an object with the address and the new content_hash and revision id.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textYesMarkdown body to write or replace. Replaces the body wholesale; it is not appended.
addressYesStable docmancer://memory/<id> address, relative path, or exact title of the memory file.
project_pathNoProject root whose memory tree the operation applies to. Omit it to use the machine-wide tree, and always omit it when this server was started pinned to a project.
expected_hashYesThe file's current content_hash from a prior read_memory call. A stale value fails safely instead of overwriting a newer revision.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed17 schema fields changedv0.9.13
    • removedInput schema / properties / address / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • removedInput schema / properties / address / default
      Removed value: -null
    • addedInput schema / properties / address / description
      Added value: +"Stable docmancer://memory/<id> address, relative path, or exact title of the memory file."
    • addedInput schema / properties / address / type
      Added value: +"string"
    • removedInput schema / properties / content
      Removed value: -{
      -  "anyOf": [
      -    {
      -      "type": "string"
      -    },
      -    {
      -      "type": "null"
      -    }
      -  ],
      -  "default": null,
      -  "title": "Content"
      -}
    • removedInput schema / properties / expected_hash / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • removedInput schema / properties / expected_hash / default
      Removed value: -null
    • addedInput schema / properties / expected_hash / description
      Added value: +"The file's current content_hash from a prior read_memory call. A stale value fails safely instead of overwriting a newer revision."
    • addedInput schema / properties / expected_hash / type
      Added value: +"string"
    • removedInput schema / properties / hash
      Removed value: -{
      -  "anyOf": [
      -    {
      -      "type": "string"
      -    },
      -    {
      -      "type": "null"
      -    }
      -  ],
      -  "default": null,
      -  "title": "Hash"
      -}
    • addedInput schema / properties / project_path / description
      Added value: +"Project root whose memory tree the operation applies to. Omit it to use the machine-wide tree, and always omit it when this server was started pinned to a project."
    • removedInput schema / properties / target
      Removed value: -{
      -  "anyOf": [
      -    {
      -      "type": "string"
      -    },
      -    {
      -      "type": "null"
      -    }
      -  ],
      -  "default": null,
      -  "title": "Target"
      -}
    • removedInput schema / properties / text / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • removedInput schema / properties / text / default
      Removed value: -null
    • addedInput schema / properties / text / description
      Added value: +"Markdown body to write or replace. Replaces the body wholesale; it is not appended."
    • addedInput schema / properties / text / type
      Added value: +"string"
    • addedInput schema / required
      Added value: +[
      +  "address",
      +  "text",
      +  "expected_hash"
      +]
  2. First observedv0.1.0

TDQS

A4.9/5.0
Behavior5/5

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

The description discloses safety behavior beyond annotations: guarded write with stale expected_hash fails safely, appends to change timeline, and preserves frontmatter/address/history. There is no contradiction with annotations; readOnlyHint=false aligns with 'MUTATING', and destructiveHint=false is consistent with the guarded, preserving nature.

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 dense but every sentence adds value—scope, safety guard, exclusions, parameter rundown, and return value. It is well-structured with a clear opening and parameter list.

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?

Given no output schema, the description explains the return object and failure mode. It also covers project_path semantics and when to omit, making the tool fully understandable for invocation.

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?

With 100% schema coverage, the description adds nuance by tying expected_hash to 'the read that produced text' and explaining the complete-replacement semantics. While most info is also in the schema, this contextual linkage provides extra 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?

The description uses a specific verb 'replace' and clearly states the scope: 'the body of one existing curated memory file while preserving its frontmatter, address, and history.' It distinguishes from siblings by explicitly saying 'Not for creating a new file: use write_memory' and 'Not for canonical memory... use pin_memory there.'

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 provides explicit when-to-use context: 'Read the file first to obtain the hash' and exclusions for pin_memory and write_memory. It also gives project_path guidance for pinned servers, making alternatives and prerequisites clear.

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