history_search
Search the undo log for a quote to find when a passage was changed or deleted and the op_id needed for undo or restore. Read-only.
Instructions
Search the undo log for a quote: in each logged request and in the text of every paragraph before and after each write, newest first. Use it to find when a passage was changed or deleted, and the op_id for history.undo or history.restore; text.find searches the current document instead. Exact by default (ignore_case, ignore_accents loosen it); match_level default or loose folds case, accents and punctuation and returns each hit's offsets and level. Works on an orphaned store too. Read-only; limit (default 20) caps hits, total counts all.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| doc | No | Path to the .docx. | |
| limit | No | Most hits to return (default 20); `total` counts them all. | |
| query | Yes | Text to find. | |
| store | No | A store folder (see history.orphans) to read instead of the document's own. | |
| ignore_case | No | Ignore case. | |
| match_level | No | Fold the search as `text.find` does: `default` ignores case, accents and punctuation (symbols such as `$` still count), `loose` drops symbols too; `exact` keeps the flags. When passed, Word's Find codes in `query` are read as their characters, every hit in a text is returned (not only the first, `exact` included), each with `start` and `end` (its offsets in that text: the request's JSON or the paragraph before or after the write, as `in` names it; not offsets into the cut `text`), `match_level` (the strictest level it meets) and `text` cut around it, and the reply gains `matches_by_level`, adding up to `total`. Without it, the first hit per text, with no `start`, `end` or level. Not with `ignore_case` or `ignore_accents` false at a folded level. | |
| ignore_accents | No | Ignore accents: `maria` finds `María`. |
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. |