caption_add
Add a numbered caption (Table, Figure, Equation) next to a Word paragraph as a tracked insertion, including label, sequence number, and optional text.
Instructions
Add a numbered caption next to a body paragraph (a table, figure or equation), as tracked insertions: label, a SEQ field with the number, and text (e.g. label Table, text "Results" gives "Table 3 Results"). position defaults to above for Table, below for Figure and Equation. A hidden bookmark wraps label and number so xref.add can point at it; field.update renumbers after later inserts. Backed up and undoable (history.undo); dry_run previews; expect.sha256 refuses a changed file. Returns the caption's address; UNSUPPORTED_CONTENT for a paragraph in a text box.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| at | Yes | Address of the body paragraph the caption goes next to. | |
| doc | Yes | Path to the .docx. | |
| tag | No | Appended to the author. | |
| text | Yes | Caption text after the number; may be empty. | |
| label | Yes | The caption label. | |
| author | No | Revision author. | |
| 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. | |
| position | No | Default: above for a Table, below for a Figure or Equation. |
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. |