comment_add
Add a comment to a specified range in a Word document, with file or live editing, dry-run preview, and hash guard to prevent overwriting changes.
Instructions
Add one comment on a range: at is a paragraph (p3#a1b2c3d4), part of one (p3#a1b2c3d4:10-15) or a span across paragraphs (p3#a1b2c3d4:10..p5#e5f6a7b8:2); a newline in text starts a new comment paragraph. Author defaults to DOC_CONTROL_AUTHOR. File engine: backed up first, dry_run previews, expect.sha256 refuses a file changed since, logged for history.undo. engine live adds it in the open Word/LibreOffice window (after live.open). Use doc.batch to add several, or with comment.reply/comment.resolve, all or nothing. Returns the new comment id.
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>",
"at": "<at>",
"text": "<text>"
},
"name": "comment_add"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| at | Yes | Range to comment on: p3#fp, p3#fp:10-15 or across. | |
| doc | Yes | Path to the .docx (live: or the file name of one open in a live app). | |
| tag | No | Appended to the author. | |
| text | Yes | Comment text; a newline starts a new paragraph. | |
| author | No | Revision author. | |
| engine | No | `live` edits the document open in Word or LibreOffice (see live.open). | |
| expect | No | Write guard: the sha256 read earlier (doc.info, or a reply's doc.sha256), e.g. {"sha256": "9f86d081…"}; a file changed since is DOC_CHANGED_ON_DISK. | |
| dry_run | No | Preview only; write nothing. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | Yes | Always true on success. | |
| op | Yes | The operation that ran. | |
| api | Yes | API version (1.0). | |
| doc | No | The document read or written: path, sha256 and paragraph count. | |
| next | Yes | Cursor for the next page (pass as cursor), or null. | |
| result | Yes | What the operation returns. | |
| warnings | Yes | Things to know about the result. |