Skip to main content
Glama

doc_write

Destructive

Edits to the open document (a file whose kind is DOC). Edits apply live for anyone viewing the document. Requires edit access. Call as {"action": "", "params": {...}}.

Read the document first (doc_read): paths shift as blocks are added or removed, and replace_blocks / delete_blocks must pass each block's hash from that read — if a block changed since, the edit is refused and nothing changes. Every edit returns the paths and hashes of the blocks it wrote, and saved: false if it hadn't been confirmed yet (it is still applied).

content is Markdown by default (headings, emphasis, links, lists, quotes, code, tables, images, ---), or ProseMirror JSON with format: "json". Keep any <qd-node .../> placeholders from read_doc when writing content back; they stand for footnotes, comments and other content Markdown can't express.

Actions: • append(content, format?) — Add blocks at the end. • insert_blocks(position, path?, hash?, content, format?) — position: "start", "end", "before" or "after"; before/after need the anchor block's path. • replace_blocks(blocks, content, format?) — Replace consecutive blocks in one section; blocks: [{path, hash}, ...]. • delete_blocks(blocks) — Delete consecutive blocks in one section; blocks: [{path, hash}, ...]. • find_replace(find, replace, case_sensitive?, whole_word?, regex?) — Replace text throughout; replacements keep the formatting of the text they replace. • batch(operations) — Up to 100 edits as one all-or-nothing change: {"operations": [{"action": "", "params": {...}}, ...]}. Paths in later operations refer to the document as earlier ones left 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_write"
  }
}

Input Schema

NameRequiredDescriptionDefault
actionYesAction to perform: insert_blocks, replace_blocks, delete_blocks, find_replace, append, or batch
paramsNoParameters for the action (see tool description). For batch: {operations: [{action, params}, ...]}

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • removedInput schema / title
      Removed value: -"DocWriteAction"
  2. Added

TDQS

A4.8/5.0
Behavior5/5

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

Beyond the annotations (destructive, non-idempotent, not read-only) it adds substantial context: edits apply live to other viewers, edit access is required, a hash mismatch refuses the edit with nothing changed, batch is all-or-nothing up to 100 ops, and it describes the return shape (paths/hashes plus saved: false meaning applied-but-unconfirmed).

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 statement, then grouped into prerequisites, content-format notes, and a bulleted action list, so it scans well. It is long for a description and the qd-node placeholder paragraph is terse enough to be slightly cryptic, but virtually every line carries operational value.

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 six-action multiplexed mutation tool with no output schema and an untyped params object, this is complete: it covers concurrency safety, content format, return values, and per-action parameters. Nothing essential to calling it correctly is missing.

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?

The schema is fully described but generic (only action and params), so the description carries the real burden and does it: it gives the calling convention, the action enum, and per-action parameter names with optionality for all six actions. It stops short of type/format detail for each param (e.g. what a path looks like), which is the only remaining gap.

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 first sentence names the specific resource and its constraint ('Edits to the open document (a file whose kind is DOC)'), and the action list enumerates exactly what operations are available (append, insert_blocks, replace_blocks, delete_blocks, find_replace, batch). An agent can tell this apart from doc_read without opening the schema.

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 states an explicit prerequisite and alternative: 'Read the document first (doc_read)' with the reason (paths shift, hashes invalidate). Each action line carries its own usage context, and the batch action states the ordering rule for paths ('refer to the document as earlier ones left it').

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.