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.

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

TDQS

A4.9/5.0
Behavior5/5

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

Goes well past the annotations by disclosing that edits apply live to concurrent viewers, that edit access is required, that stale block hashes cause a refusal with no partial change, and that responses carry the written paths/hashes plus a saved:false signal that still means applied. The batch atomicity and 100-operation cap are non-obvious traits an agent must know before calling.

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 key constraints, then bulleted actions, with no filler sentences. It is dense and long, but each sentence carries required behavior (hash staleness, qd-node placeholders, saved:false). Minor cost: the read_doc reference conflicts with the actual sibling name doc_read, which briefly blurs the pointer.

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 destructive, non-idempotent, multi-action mutation tool with no output schema, the description covers prerequisites, failure modes, return payload, and content-format preservation. Nothing an agent needs in order to call it correctly appears to be missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema only defines a bare action string and an opaque params blob, so the description carries the real load: it documents every action's signature, the position enum for insert_blocks, the {path, hash} shape for replace_blocks/delete_blocks, the find_replace flags, and the batch operations envelope. This is meaning the schema does not supply.

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 and resource ('Edits to the open document') and immediately scopes it to files whose kind is DOC, which separates it from slide_write, files_write and write_data. The action list makes the concrete operations available 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?

Explicit sequencing is given: read with doc_read first, then pass block paths and hashes because paths shift. It also names the routing alternative by implication (doc_read) and explains when to use batch versus individual actions (up to 100 edits as one all-or-nothing change).

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.