Change a Word doc
edit_wordChange a Word doc by block ID, at the version you read ("base"). Every op in one call applies in order, all or none: up to 500 ops or 1 MB, so read once and send every change together. Ops: {"replace": {"block"?: "p14", "find": "thirty days", "with": "forty-five days", "all"?: true}} (no "block" and "all": true replaces across the doc with no read; "md" instead of "with" for inline Markdown); {"insert": {"after" | "before": "h3", "md": "## Fees\n\nThe Client pays…"}} ("at": "start" | "end" too); {"set": {"blocks": ["p15"], "style"?: "Heading 2" | "Quote" | "Normal"…, "align"?: "center", "list"?: "bullet" | "numbered" | "none", "level"?: 1}}; {"delete": {"blocks": ["l9"]}}; {"move": {"blocks": ["h5"], "after": "p40"}} (a heading moves with its section); {"table": {"after": "p20", "rows": [["Phase", "Due"], ["Design", "1 Dec"]]}}; {"cells": {"table": "t2", "set": {"r3.c2": "2 Jan"}}}; {"image": {"after": "p8", "media": "", "width": "60%"}}; {"page_break": {"after": "p31"}}; {"page": {"size": "A4", "margins": "2.5cm"}}; {"footer" | "header": {"md": "Cedarline Homes · Page {page} of {pages}"}}; {"accept": ["sg12"]}, {"reject": ["sg13"]} (your own suggestions only). An op that makes blocks can name them, "as": "$fees", and later ops use "$fees" ("after" goes after all it made). Under the doc's "AI changes: Suggest" (the default) your edits land as suggestions people accept or reject; moves, page setup, headers and footers land as edits. The answer has the new version, the new IDs and each changed block's new text: no need to read again.
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>",
"ops": "<ops>"
},
"name": "edit_word"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| doc | Yes | The doc's link or its code. | |
| key | No | A retry key, up to 64 characters. Default: one made from the request. | |
| ops | Yes | A list of ops, each {"name": {…}}: replace, insert, set, delete, move, table, cells, image, page_break, page, footer, header, accept, reject. | |
| base | Yes | The version you read: v N in get. | |
| note | No | Why, in a few words. Shown in changes and History. | |
| dryRun | No | Work it out and answer, saving nothing. | |
| answers | No | An ask's ID ("a12", from get "asks"): this change answers it and closes it. |