Skip to main content
Glama

Change a document

doc_update
Destructive

Change a document or directory that exists. Every change commits or is refused; expected_commit (from action=document's trailer) refuses one that has changed since you read it, with what is there now. A change to a section another agent has claimed is refused unless override_claim=true, which they see. A document open in somebody's editor takes the change into their session. Actions — edit: replace old_string with new_string (replace_all for every occurrence), or add append at the end of the document or of a section; with span, new_string replaces that one block (or old_string inside it) however large the document; refused, with the current text, if old_string is missing or ambiguous, the frontmatter would break, or another writer committed first. replace: replace a whole document's content (location or node, content); refused when nothing is there. move: rename in place (from, name) or move (from, to: the whole new location), keeping id, history and comments. A rename needs editor on everything it moves; a move to another directory needs a manager of the whole organization, so an agent delegated over folders rather than the whole organization cannot move between them. A move that widens who can reach it is refused naming who gains, until acknowledge_access_change=true. A document another agent has claimed is refused unless override_claim=true, which they see. restore: undo the last delete at a location, with its sharing; restoring twice finds nothing the second time. restore_version: put an earlier version of a document back (location or node, commit from browse action=versions), as the console's Restore this version does: its text becomes a NEW version on top, so nothing in the history is rewritten or lost, and the document's current metadata is kept. Needs editor; expected_commit refuses it if the document changed since you read it.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "action": "<action>"
    },
    "name": "doc_update"
  }
}

Input Schema

NameRequiredDescriptionDefault
toNomove: the whole new location including the name, e.g. wiki/archive/attention.md; a folder's link moves it into that folder. A console link (`/d/<Name-Slug>-<32 hex>`, whole or just its id) is accepted too.
fromNomove: the document or directory's whole location, e.g. wiki/attention.md. A console link (`/d/<Name-Slug>-<32 hex>`, whole or just its id) is accepted too.
nameNomove: the new last segment, to rename in place, e.g. self-attention.md (no slash)
nodeNoedit, replace, restore_version: the document's id, as returned beside its location — survives a rename or a move, so a citation written into a stored document keeps pointing at the right thing. Give this OR location, never both. A console link (`/d/<Name-Slug>-<32 hex>`, whole or just its id) is accepted too.
seatNothe seat token identity_write action=take_seat gave you; pass it on every call while you drive that agent, and each call that carries it keeps the seat yours for a whole lease from that call
spanNoedit: a block's span id (search within, browse action=spans): new_string replaces that one block, or, with old_string, old_string inside it; the rest of the document is not read back to you
actionYeswhat to do; each action takes the arguments its line names
appendNoedit: text to add at the end of the document, or of `section`, instead of replacing anything
commitNorestore_version: the version's commit hash, as browse action=versions lists it (any lowercase prefix of at least 7 hex characters that names one)
contentNoreplace: the whole document. Set metadata with YAML frontmatter at the top of `content`: `type` (one of: meeting-notes, playbook, spec, brand-asset, web-clip, contract, misc — anything else becomes misc), `title`, `summary`, and `tags` as a list. `tags` is the write-side spelling of what the listing tools call `label`. `status` takes `active` or `inactive` and is not a label: `inactive` retires a document — search and listings stop showing it, while whoever may write it still opens it by location or node, and removing the line brings it back. Omit it unless you mean to retire something. `aliases` (a list, or one name) are other names search how=titles finds the document by; a [[link]] still needs its file name or title. Any other key you write (`sources`, …) is kept as written and comes back on read; key order may change. A block that does not parse as YAML is refused, naming the line, and nothing is written: quote a value that contains ": " (summary: "a: b").
sectionNoedit: with append: the heading text of the section to add to the end of, exactly as written after the #s ("Log" for "## Log"), the same as claim's span; refused if no heading or several have that text. Omit for the end of the document
locationNoedit, replace, restore_version: full path from the workspace root, e.g. "handbook/vendor/acme.md". Give this OR node. A path is what a person reads; a node is what survives somebody reorganizing. · restore: full path from the workspace root, e.g. "handbook/vendor/acme.md" (as printed by browse action=documents or search). A console link (`/d/<Name-Slug>-<32 hex>`, whole or just its id) is accepted too.
acting_asNoan agent identity below you, or one working in a folder you can write (pass its seat too), by its id (from identity_write action=spawn) or its @handle (brief_me lists your agents with both), to make this one call as, with that agent's narrower access; for a helper whose session signs in as its person
new_stringNoedit: what to put in its place
old_stringNoedit: exact text to replace — must appear in the current body (with new_string; not with append)
replace_allNoedit: replace every occurrence (default: refuse if more than one)
override_claimNoedit: write even though another agent has CLAIMED the section you are changing. Logged, and they will see it. Default: refuse and name the holder. · replace, restore_version: write even though another agent has CLAIMED this document. Logged, and they will see it. Default: refuse and name the holder. · move: move even though another agent has CLAIMED a document this moves. Logged, and they will see it. Default: refuse and name the holder.
expected_commitNoedit: the document head you read at (read action=document prints it; any lowercase prefix of at least 7 hex characters, and a part's pin with its #part). Refuses if that document has changed since. · replace: the document head you read at (read action=document prints it; any lowercase prefix of at least 7 hex characters). Refuses if that document has changed since, and refuses a part's pin (ending #part): this overwrites the whole document. Omit to replace whatever is there now. · restore_version: the document head you read at (read action=document prints it; any lowercase prefix of at least 7 hex characters). Refuses if that document has changed since, and refuses a part's pin (ending #part): this overwrites the whole document. Omit to restore over whatever is there now.
idempotency_keyNoAny unique string you choose for this write, e.g. a UUID. If you retry the call with the same key and the same arguments, the first answer is returned and nothing is done twice. Reusing a key for a different request is refused. Keys are kept 24 hours.
acknowledge_access_changeNomove: true once you have seen who gains reach and mean it

Output Schema

NameRequiredDescriptionDefault
toNo
fromNo
textNothe answer as prose, for an action that answers in prose
spansNothe blocks this write added or edited, in document order; absent when no commit was written
actionYesthe action that answered
commitNothe head of the folder the move landed in, not the moved document's own commit, so not an expected_commit (read the document for that); null for a top-level folder's rename, which writes no commit
storedNowhat the document's head stores after this call, to check against what was sent (#1492)
changedNothe documents that moved, a directory's documents included, the first 25 by path; directories themselves are not listed
appendedNoappend only: what this call added
locationNothe whole path from the workspace root this write resolved to; present on a successful write
restoredNowhat the restore put back, and the new version it made of it
changed_totalNohow many documents moved, whether or not changed lists them all

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedInput schema / properties / seat / description
      Previous value: -"the seat token identity_write action=take_seat gave you; pass it on every call while you drive that agent, and each call that carries it keeps the seat yours for its lease"New value: +"the seat token identity_write action=take_seat gave you; pass it on every call while you drive that agent, and each call that carries it keeps the seat yours for a whole lease from that call"
  2. Changed1 schema field changed
    • changedInput schema / properties / acting_as / description
      Previous value: -"an agent identity below you, by its id (from identity_write action=spawn) or its @handle (brief_me lists your agents with both), to make this one call as, with that agent's narrower access; for a helper whose session signs in as its person"New value: +"an agent identity below you, or one working in a folder you can write (pass its seat too), by its id (from identity_write action=spawn) or its @handle (brief_me lists your agents with both), to make this one call as, with that agent's narrower access; for a helper whose session signs in as its person"
  3. Changed6 schema fields changed
    • removedOutput schema / additionalProperties
      Removed value: -false
    • removedOutput schema / properties / appended / additionalProperties
      Removed value: -false
    • removedOutput schema / properties / changed / items / additionalProperties
      Removed value: -false
    • removedOutput schema / properties / restored / additionalProperties
      Removed value: -false
    • removedOutput schema / properties / spans / items / additionalProperties
      Removed value: -false
    • removedOutput schema / properties / stored / additionalProperties
      Removed value: -false
  4. Changed2 schema fields changed
    • changedInput schema / properties / acting_as / description
      Previous value: -"an agent identity below you (its id, from identity_write action=spawn) to make this one call as, with that agent's narrower access; for a helper whose session signs in as its person"New value: +"an agent identity below you, by its id (from identity_write action=spawn) or its @handle (brief_me lists your agents with both), to make this one call as, with that agent's narrower access; for a helper whose session signs in as its person"
    • changedInput schema / properties / seat / description
      Previous value: -"the seat token identity_write action=take_seat gave you; pass it on every call while you drive that agent"New value: +"the seat token identity_write action=take_seat gave you; pass it on every call while you drive that agent, and each call that carries it keeps the seat yours for its lease"
  5. Changed1 schema field changed
    • changedInput schema / properties / override_claim / description
      Previous value: -"edit: write even though another agent has CLAIMED the section you are changing. Logged, and they will see it. Default: refuse and name the holder. · replace, restore_version: write even though another agent has CLAIMED this document. Logged, and they will see it. Default: refuse and name the holder."New value: +"edit: write even though another agent has CLAIMED the section you are changing. Logged, and they will see it. Default: refuse and name the holder. · replace, restore_version: write even though another agent has CLAIMED this document. Logged, and they will see it. Default: refuse and name the holder. · move: move even though another agent has CLAIMED a document this moves. Logged, and they will see it. Default: refuse and name the holder."
  6. Changed3 schema fields changed
    • changedInput schema / properties / expected_commit / description
      Previous value: -"edit: the document head you read at (read action=document prints it; any lowercase prefix of at least 7 hex characters). Refuses if that document has changed since. · replace: the document head you read at (read action=document prints it; any lowercase prefix of at least 7 hex characters). Refuses if that document has changed since. Omit to replace whatever is there now. · restore_version: the document head you read at (read action=document prints it; any lowercase prefix of at least 7 hex characters). Refuses if that document has changed since. Omit to restore over whatever is there now."New value: +"edit: the document head you read at (read action=document prints it; any lowercase prefix of at least 7 hex characters, and a part's pin with its #part). Refuses if that document has changed since. · replace: the document head you read at (read action=document prints it; any lowercase prefix of at least 7 hex characters). Refuses if that document has changed since, and refuses a part's pin (ending #part): this overwrites the whole document. Omit to replace whatever is there now. · restore_version: the document head you read at (read action=document prints it; any lowercase prefix of at least 7 hex characters). Refuses if that document has changed since, and refuses a part's pin (ending #part): this overwrites the whole document. Omit to restore over whatever is there now."
    • changedInput schema / properties / expected_commit / pattern
      Previous value: -"^[0-9a-f]{7,64}$"New value: +"^[0-9a-f]{7,64}(#part)?$"
    • addedOutput schema / properties / spans
      Added value: +{
      +  "description": "the blocks this write added or edited, in document order; absent when no commit was written",
      +  "items": {
      +    "additionalProperties": false,
      +    "properties": {
      +      "change": {
      +        "description": "added: a new block; edited: an existing block given new text, same id",
      +        "enum": [
      +          "added",
      +          "edited"
      +        ],
      +        "type": "string"
      +      },
      +      "id": {
      +        "description": "the span id: what truth, comment and claim anchor to",
      +        "type": "string"
      +      },
      +      "index": {
      +        "description": "the block's position in the document's new head, 0-based",
      +        "maximum": 9007199254740991,
      +        "minimum": -9007199254740991,
      +        "type": "integer"
      +      }
      +    },
      +    "required": [
      +      "id",
      +      "index",
      +      "change"
      +    ],
      +    "type": "object"
      +  },
      +  "type": "array"
      +}
  7. Changed2 schema fields changed
    • changedInput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
    • changedOutput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
  8. Changed1 schema field changed
    • changedInput schema / properties / content / description
      Previous value: -"replace: the whole document. Set metadata with YAML frontmatter at the top of `content`: `type` (one of: meeting-notes, playbook, spec, brand-asset, web-clip, contract, misc — anything else becomes misc), `title`, `summary`, and `tags` as a list. `tags` is the write-side spelling of what the listing tools call `label`. `status` takes `active` or `inactive` and is not a label: `inactive` retires a document — it stays in the folder and stays openable in the console, but agents stop retrieving it. Omit it unless you mean to retire something. `aliases` (a list, or one name) are other names search how=titles finds the document by; a [[link]] still needs its file name or title. Any other key you write (`sources`, …) is kept as written and comes back on read; key order may change. A block that does not parse as YAML is refused, naming the line, and nothing is written: quote a value that contains \": \" (summary: \"a: b\")."New value: +"replace: the whole document. Set metadata with YAML frontmatter at the top of `content`: `type` (one of: meeting-notes, playbook, spec, brand-asset, web-clip, contract, misc — anything else becomes misc), `title`, `summary`, and `tags` as a list. `tags` is the write-side spelling of what the listing tools call `label`. `status` takes `active` or `inactive` and is not a label: `inactive` retires a document — search and listings stop showing it, while whoever may write it still opens it by location or node, and removing the line brings it back. Omit it unless you mean to retire something. `aliases` (a list, or one name) are other names search how=titles finds the document by; a [[link]] still needs its file name or title. Any other key you write (`sources`, …) is kept as written and comes back on read; key order may change. A block that does not parse as YAML is refused, naming the line, and nothing is written: quote a value that contains \": \" (summary: \"a: b\")."
  9. Changed2 schema fields changed
    • addedInput schema / properties / span
      Added value: +{
      +  "description": "edit: a block's span id (search within, browse action=spans): new_string replaces that one block, or, with old_string, old_string inside it; the rest of the document is not read back to you",
      +  "type": "string"
      +}
    • addedOutput schema / properties / location
      Added value: +{
      +  "description": "the whole path from the workspace root this write resolved to; present on a successful write",
      +  "type": "string"
      +}
  10. Changed9 schema fields changed
    • addedInput schema / properties / seat
      Added value: +{
      +  "description": "the seat token identity_write action=take_seat gave you; pass it on every call while you drive that agent",
      +  "maxLength": 64,
      +  "type": "string"
      +}
    • removedOutput schema / properties / appended / properties / commit / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • addedOutput schema / properties / appended / properties / commit / type
      Added value: +[
      +  "string",
      +  "null"
      +]
    • removedOutput schema / properties / appended / properties / section / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • addedOutput schema / properties / appended / properties / section / type
      Added value: +[
      +  "string",
      +  "null"
      +]
    • removedOutput schema / properties / commit / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • addedOutput schema / properties / commit / type
      Added value: +[
      +  "string",
      +  "null"
      +]
    • removedOutput schema / properties / restored / properties / commit / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • addedOutput schema / properties / restored / properties / commit / type
      Added value: +[
      +  "string",
      +  "null"
      +]
  11. Changed1 schema field changed
    • addedInput schema / properties / acting_as
      Added value: +{
      +  "description": "an agent identity below you (its id, from identity_write action=spawn) to make this one call as, with that agent's narrower access; for a helper whose session signs in as its person",
      +  "type": "string"
      +}
  12. Changed7 schema fields changed
    • changedInput schema / properties / action / enum
      Previous value: -[
      -  "edit",
      -  "replace",
      -  "move",
      -  "restore"
      -]New value: +[
      +  "edit",
      +  "replace",
      +  "move",
      +  "restore",
      +  "restore_version"
      +]
    • addedInput schema / properties / commit
      Added value: +{
      +  "description": "restore_version: the version's commit hash, as browse action=versions lists it (any lowercase prefix of at least 7 hex characters that names one)",
      +  "pattern": "^[0-9a-f]{7,64}$",
      +  "type": "string"
      +}
    • changedInput schema / properties / expected_commit / description
      Previous value: -"edit: the document head you read at (read action=document prints it; any lowercase prefix of at least 7 hex characters). Refuses if that document has changed since. · replace: the document head you read at (read action=document prints it; any lowercase prefix of at least 7 hex characters). Refuses if that document has changed since. Omit to replace whatever is there now."New value: +"edit: the document head you read at (read action=document prints it; any lowercase prefix of at least 7 hex characters). Refuses if that document has changed since. · replace: the document head you read at (read action=document prints it; any lowercase prefix of at least 7 hex characters). Refuses if that document has changed since. Omit to replace whatever is there now. · restore_version: the document head you read at (read action=document prints it; any lowercase prefix of at least 7 hex characters). Refuses if that document has changed since. Omit to restore over whatever is there now."
    • changedInput schema / properties / location / description
      Previous value: -"edit, replace: full path from the workspace root, e.g. \"handbook/vendor/acme.md\". Give this OR node. A path is what a person reads; a node is what survives somebody reorganizing. · restore: full path from the workspace root, e.g. \"handbook/vendor/acme.md\" (as printed by browse action=documents or search). A console link (`/d/<Name-Slug>-<32 hex>`, whole or just its id) is accepted too."New value: +"edit, replace, restore_version: full path from the workspace root, e.g. \"handbook/vendor/acme.md\". Give this OR node. A path is what a person reads; a node is what survives somebody reorganizing. · restore: full path from the workspace root, e.g. \"handbook/vendor/acme.md\" (as printed by browse action=documents or search). A console link (`/d/<Name-Slug>-<32 hex>`, whole or just its id) is accepted too."
    • changedInput schema / properties / node / description
      Previous value: -"edit, replace: the document's id, as returned beside its location — survives a rename or a move, so a citation written into a stored document keeps pointing at the right thing. Give this OR location, never both. A console link (`/d/<Name-Slug>-<32 hex>`, whole or just its id) is accepted too."New value: +"edit, replace, restore_version: the document's id, as returned beside its location — survives a rename or a move, so a citation written into a stored document keeps pointing at the right thing. Give this OR location, never both. A console link (`/d/<Name-Slug>-<32 hex>`, whole or just its id) is accepted too."
    • changedInput schema / properties / override_claim / description
      Previous value: -"edit: write even though another agent has CLAIMED the section you are changing. Logged, and they will see it. Default: refuse and name the holder. · replace: write even though another agent has CLAIMED this document. Logged, and they will see it. Default: refuse and name the holder."New value: +"edit: write even though another agent has CLAIMED the section you are changing. Logged, and they will see it. Default: refuse and name the holder. · replace, restore_version: write even though another agent has CLAIMED this document. Logged, and they will see it. Default: refuse and name the holder."
    • addedOutput schema / properties / restored
      Added value: +{
      +  "additionalProperties": false,
      +  "description": "what the restore put back, and the new version it made of it",
      +  "properties": {
      +    "commit": {
      +      "anyOf": [
      +        {
      +          "type": "string"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ],
      +      "description": "the NEW commit the restore made; null when the document already said exactly that"
      +    },
      +    "from": {
      +      "description": "the version that was put back",
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "from",
      +    "commit"
      +  ],
      +  "type": "object"
      +}
  13. Changed2 schema fields changed
    • changedInput schema / properties / location / description
      Previous value: -"edit, replace: full path from the workspace root, e.g. \"handbook/vendor/acme.md\". Give this OR node. A path is what a person reads; a node is what survives somebody reorganizing. · restore: full path from the workspace root, e.g. \"handbook/vendor/acme.md\" (as printed by browse action=documents or search)"New value: +"edit, replace: full path from the workspace root, e.g. \"handbook/vendor/acme.md\". Give this OR node. A path is what a person reads; a node is what survives somebody reorganizing. · restore: full path from the workspace root, e.g. \"handbook/vendor/acme.md\" (as printed by browse action=documents or search). A console link (`/d/<Name-Slug>-<32 hex>`, whole or just its id) is accepted too."
    • addedOutput schema / properties / stored
      Added value: +{
      +  "additionalProperties": false,
      +  "description": "what the document's head stores after this call, to check against what was sent (#1492)",
      +  "properties": {
      +    "bytes": {
      +      "description": "the stored body's length in UTF-8 bytes; frontmatter is kept beside the body, not in it",
      +      "maximum": 9007199254740991,
      +      "minimum": -9007199254740991,
      +      "type": "integer"
      +    },
      +    "previousBytes": {
      +      "anyOf": [
      +        {
      +          "maximum": 9007199254740991,
      +          "minimum": -9007199254740991,
      +          "type": "integer"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ],
      +      "description": "the length of the body this replaced; null when nothing was there"
      +    },
      +    "sha256": {
      +      "description": "the stored body's sha256, hex",
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "bytes",
      +    "sha256",
      +    "previousBytes"
      +  ],
      +  "type": "object"
      +}
  14. Added

TDQS

A4.5/5.0
Behavior5/5

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

The description adds substantial behavior beyond the annotations: every change commits or is refused, expected_commit protects against concurrent edits, claimed sections require override_claim, open editor sessions receive the change, access-widening moves require acknowledgment, and restore_version creates a new version rather than rewriting history. These details materially help an agent predict side effects and refusal conditions.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is dense and mostly a single long paragraph, with some repetition around override_claim and expected_commit. The length is partly justified by the tool's complexity, but clearer structure and trimming of duplicated clauses would improve readability and make each sentence earn its place.

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 the high-complexity, 20-parameter schema and the presence of an output schema, the description covers the important action semantics, refusal conditions, authorization implications, and side effects. Annotations already handle the destructive/read-only profile, and the description supplies the behavioral context an agent needs to invoke the tool correctly.

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 100%, so the baseline is 3, but the description adds action-level context that maps parameters to workflows, such as how span, old_string, new_string, section, append, expected_commit, and override_claim interact per action. Much of this is also present in the schema, so it does not reach full additional value, but it does clarify parameter use in context.

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: 'Change a document or directory that exists.' It then enumerates the exact update actions (edit, replace, move, restore, restore_version), making clear this is for modifying existing content rather than creating, reading, or deleting documents.

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?

Usage context is clear for each action: edit replaces or appends text, replace overwrites content, move renames or relocates, restore undoes a delete, and restore_version restores an earlier commit as a new version. It does not explicitly route agents to doc_create for new documents or doc_delete for deletions, but the 'exists' constraint and action list provide strong implied guidance.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources