Skip to main content
Glama

Edit a document

ragdown_edit
Destructive

Replace exact passages in an existing Markdown document without rewriting the whole file. Each edit swaps old text for new, deletes with empty text, and all edits apply or none do.

Instructions

Change part of an existing document without sending the rest of it: each edit swaps one exact passage (old_text) for another (new_text). old_text must match the document character for character, as ragdown_read_doc returned it, and be there exactly once unless replace_all is true, so include enough of the surrounding text to make it unique. Edits are made in order, each on the result of the one before, and if any of them does not apply nothing is written. An empty new_text deletes the passage. A passage that is not found is answered with the nearest one the document does have.

Input Schema

NameRequiredDescriptionDefault
pathYesPath of a Markdown file relative to the documents root, e.g. 'projects/alpha.md'
editsYes
base_hashNoThe hash from ragdown_read_doc. Optional: if the file changed since, nothing is written

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed7 schema fields changedv6.6.0
    • removedInput schema / properties / append
      Removed value: -{
      -  "default": false,
      -  "type": "boolean"
      -}
    • changedInput schema / properties / base_hash / description
      Previous value: -"The hash from ragdown_read_doc; required to replace an existing document"New value: +"The hash from ragdown_read_doc. Optional: if the file changed since, nothing is written"
    • addedInput schema / properties / edits
      Added value: +{
      +  "items": {
      +    "additionalProperties": false,
      +    "properties": {
      +      "new_text": {
      +        "description": "What replaces it; empty to delete the passage",
      +        "type": "string"
      +      },
      +      "old_text": {
      +        "description": "The passage to replace, exactly as it is in the document",
      +        "minLength": 1,
      +        "type": "string"
      +      },
      +      "replace_all": {
      +        "default": false,
      +        "description": "Replace every occurrence of old_text rather than require one",
      +        "type": "boolean"
      +      }
      +    },
      +    "required": [
      +      "old_text",
      +      "new_text"
      +    ],
      +    "type": "object"
      +  },
      +  "minItems": 1,
      +  "type": "array"
      +}
    • removedInput schema / properties / heading
      Removed value: -{
      -  "description": "With append: add to the end of the section under this heading",
      -  "type": "string"
      -}
    • removedInput schema / properties / session_id
      Removed value: -{
      -  "description": "Stable id of the conversation, recorded in the frontmatter of a document this creates",
      -  "type": "string"
      -}
    • removedInput schema / properties / text
      Removed value: -{
      -  "description": "The document's new Markdown, or with append, what to add",
      -  "minLength": 1,
      -  "type": "string"
      -}
    • changedInput schema / required
      Previous value: -[
      -  "path",
      -  "text"
      -]New value: +[
      +  "path",
      +  "edits"
      +]
  2. Changed4 schema fields changedv5.16.0
    • changedInput schema / properties / base_hash / description
      Previous value: -"The hash from ragdown_read_doc; required to replace an existing note"New value: +"The hash from ragdown_read_doc; required to replace an existing document"
    • changedInput schema / properties / path / description
      Previous value: -"Path of a Markdown file relative to the notes root, e.g. 'projects/alpha.md'"New value: +"Path of a Markdown file relative to the documents root, e.g. 'projects/alpha.md'"
    • addedInput schema / properties / session_id
      Added value: +{
      +  "description": "Stable id of the conversation, recorded in the frontmatter of a document this creates",
      +  "type": "string"
      +}
    • changedInput schema / properties / text / description
      Previous value: -"The note's new Markdown, or with append, what to add"New value: +"The document's new Markdown, or with append, what to add"
  3. Addedv5.9.0

TDQS

A4.6/5.0
Behavior5/5

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

Annotations only declare destructiveHint=true and readOnlyHint=false; the description adds substantially more: edits are applied in order on the prior result, the operation is atomic ('if any of them does not apply nothing is written'), empty new_text deletes, and a missing passage returns the nearest match instead of silently failing. That is real behavioral context an agent cannot get from the annotations.

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?

Four sentences, purpose first, then matching rules, then ordering/atomicity, then edge cases. No filler; every sentence carries operational information.

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?

With no output schema, the description usefully covers failure behavior (nearest-passage response, all-or-nothing writes), but it never says what a successful edit returns — notably the updated hash implied by the base_hash parameter — leaving the agent to infer the success payload.

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 67%, and the description compensates: it explains the character-for-character match requirement, the exactly-once uniqueness constraint, the 'include enough surrounding text' remedy, and the delete-by-empty-new_text convention. It does not address the optional base_hash precondition, which only the schema documents.

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 ('Change part of an existing document') and the exact mechanism ('each edit swaps one exact passage (old_text) for another (new_text)'). This clearly distinguishes it from the sibling full-document writer ragdown_write and from ragdown_read_doc, which it names as the source of old_text.

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?

Tells the agent how to obtain old_text ('as ragdown_read_doc returned it') and the condition under which replace_all is needed, and 'without sending the rest of it' implicitly routes the agent away from a full rewrite. It stops short of explicitly naming ragdown_write as the alternative or stating when not to use this tool.

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