search_document runs a regular expression over the document and returns the matching blocks,
ready to edit - without pulling the whole document into the conversation.
Use it to jump straight to the passages you care about, or to locate text in a document too
large to read whole. The document is converted to the same HTML
read_document returns, so an anchor from either tool is equally
valid.
Parameters
1-based index of the first match to return. Use it to page through a pattern
with more matches than one call can carry.
_meta under com.vespper/session-id. See
Document sessions. Vespper SDK
auto-patching supplies this metadata automatically.
Pattern examples
The pattern is matched against both the HTML and the text a reader sees in it. A phrase Word
split across
<span> runs, or spelled with a non-breaking space, still matches when typed
plainly - and a pattern naming markup (a class, an <ins>, a tag) still works. Only the
document’s content is searched, never the stylesheet in its <head>, so a pattern naming a CSS
class finds the blocks carrying it rather than the rule that defines it.
Returns
true when matches remain. Fetch them with start_at - for example
start_at=9 after eight came back.One line stating the paging situation, and whether a relaxation was applied.
If the pattern only matched by ignoring case or collapsing a repeated space,
note says so.Example
Duplicate blocks
Two spots that read identically - a running footer, a repeated placeholder - come back as two matches with the samematch_text, both marked unique: false. That is not a mistake and not a
reason to search again; they differ by page, which is how you pick the one you want.
To edit a non-unique block, extend old to include a neighbouring block that is unique. See
Making an anchor unique.
Errors
An empty or whitespace-onlypattern returns { error: "invalid_pattern", message } without
touching the document. An unknown, closed, or user-mismatched session returns
document session not found.
