Skip to main content
read_document converts the attached .docx and returns a contiguous range of its logical pages as HTML. Every edit anchor must be markup copied verbatim from this tool or from search_document, so read a spot before you edit it. Reach for this when you need the shape of a document — what sections exist, how a table is laid out, where a new paragraph belongs. If you already know the text you want to change, search_document is faster and cheaper.

Parameters

integer
default:"1"
1-based first page to return.
integer
1-based last page to return. Omit for a default span starting at start_page.
The document itself travels in _meta under com.vespper/document. See Attaching the document.

Returns

string
The HTML projection of the requested page range. Its last line always states the range in words, for example Pages 3-7 of 42 returned; 35 pages remain.
integer
First page actually returned.
integer
Last page actually returned. May be lower than the end_page you asked for, because a call is also capped by a token budget.
integer
Pages in the whole document.
integer
Approximate token count of the returned html.
integer
Approximate token count of the whole document.
boolean
true when pages remain past end_page. Fetch them with start_page = end_page + 1.
integer
Size of the attached document.
number
Metered cost of this call. Reads are billed as conversions, with no LLM involved.

Example

Paging through a long document

A wide end_page is still bounded by the per-call token budget, so on a large document has_more stays true. Keep calling with start_page = end_page + 1 until it is false. Anchors copied from any page match the whole document, so you can edit straight from a page without re-reading it. Don’t page through a document hunting for a string — search for it.

Existing tracked changes

Changes already in the document render as <ins> and <del> elements, each carrying a data-author. Use them to see which changes are pending and who made them before you accept, reject, or modify one — see Resolving a tracked change.

Errors

Failures return { error, message } rather than raising: message is agent-facing copy that says what to do next. Out of credits returns HTTP 402 upstream and a message that says so; a missing _meta document returns No document attached.