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. 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.

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
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 (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_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.
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. 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"
      +}
  2. 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"
  3. 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\")."
  4. 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"
      +}
  5. 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"
      +]
  6. 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"
      +}
  7. 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"
      +}
  8. 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"
      +}
  9. Added

TDQS

A4.6/5.0
Behavior5/5

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

The description adds substantial behavioral detail beyond the annotations: commit-or-refuse semantics, optimistic concurrency via expected_commit, claim overrides, editor-session effects, permission requirements for rename and move, access-widening acknowledgment, and restore_version's append-only history behavior. These are consistent with the destructive and non-read-only annotations.

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?

The description is front-loaded and every sentence carries operational information, which is appropriate for a complex 20-parameter mutation tool. However, it is a dense single paragraph and could be more scannable with action-level structure.

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 complex destructive mutation tool with many optional parameters, the description covers concurrency, refusal conditions, permissions, access changes, and action-specific behavior. With annotations and an output schema present, this is sufficiently complete for an agent to call 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 schema already defines the parameters in detail. The description adds useful cross-parameter meaning, especially how expected_commit, override_claim, append, section, move permissions, and access acknowledgment interact with each action.

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 specific verb and resource: "Change a document or directory that exists." It then enumerates the supported actions (edit, replace, move, restore, restore_version), making the tool's scope clear and distinguishing it from creation or deletion.

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 description gives strong action-level guidance, including when each action applies and what causes refusal. It does not explicitly route agents away from sibling tools such as doc_create or doc_delete, but the "exists" constraint implicitly distinguishes this tool from creation.

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