Skip to main content
Glama

Edit a Markdown or HTML doc

edit_doc

Changes a Markdown or HTML doc by exact text, without sending the whole file: each edit finds text and replaces it, in order. Read it first with get; its entry is the base. A find matches the file as stored: for HTML its source, not the readable text get gives with "text". All or none: a find that isn't there, or is there more than once without "all", changes nothing and says why. A newer entry since the base still takes the edits if every find holds there. Answers the new entry and the lines around each change. Up to 50 edits a call.

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": {
      "doc": "<doc>",
      "base": "<base>",
      "edits": "<edits>"
    },
    "name": "edit_doc"
  }
}

Input Schema

NameRequiredDescriptionDefault
docYesThe doc's link or its code.
baseYesThe entry you read: entry in get.
noteNoKeep this entry as a saved point, with this note.
editsYes[{"find": "exact text", "with": "new text"}], applied in order.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.6/5.0
Behavior5/5

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

Beyond the annotations (readOnlyHint=false, destructiveHint=false), it discloses all-or-none atomicity, that failures explain why, edit ordering, the 50-edit cap, what is returned ("the new entry and the lines around each change"), and non-destructive versioning semantics via base/entry. The HTML source-vs-rendered-text caveat is a real gotcha the annotations could never convey, and nothing contradicts destructiveHint=false since edits are versioned.

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?

Front-loaded with the core behavior, then prerequisites, failure modes, concurrency, and limits — nearly every clause carries new information. The telegraphic phrasing ("its entry is the base") is occasionally compressed to the point of ambiguity, which keeps it off a 5.

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 4-parameter mutation tool with no output schema, the description covers prerequisites, atomicity, failure reporting, ordering, edit limits, concurrency behavior, and even the shape of the response. An agent has everything needed to call this correctly on the first attempt with no reliance on sibling lookups beyond get.

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 a 3 baseline applies, but the description adds genuine meaning: it ties "base" to the entry returned by get, explains that the whole batch aborts if a find is missing or ambiguous without "all", and clarifies that "find" matches stored source for HTML. That last point in particular is not derivable from the schema.

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?

"Changes a Markdown or HTML doc by exact text, without sending the whole file: each edit finds text and replaces it, in order" gives a specific verb (change/replace), the resource (Markdown or HTML doc), and the mechanism (find/replace applied in order). The format restriction (Markdown or HTML) implicitly separates it from edit_word, edit_slides, and edit_sheet siblings.

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?

"Read it first with get; its entry is the base" states an explicit prerequisite and names the sibling to call first, and the concurrency note ("a newer entry since the base still takes the edits if every find holds there") tells the agent how stale bases behave. What's missing is any explicit when-not-to-use guidance, e.g. when to prefer edit_word or a full-file rewrite, so this stops short of a 5.

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