read_document
Extracts raw text from PDF, Office, EPUB, HTML, CSV, Markdown, and notebook files, with PDF page ranges, OCR for scanned pages, and paginated offsets for long documents.
Instructions
Read text content from a document with optional page selection. Use this when you need the raw text of a PDF, TXT, MD, CSV, DOCX, XLSX, PPTX, ODT, EPUB, HTML, RTF or IPYNB file; TXT/MD/CSV are returned verbatim, the Office, EPUB, HTML, RTF and notebook formats via pandoc; PDFs support page ranges (e.g. "1-5", "1-3,7,10-12") and auto-OCR fallback for scanned pages. Long texts come in pages of max_chars characters; a truncated result ends with the offset to ask for next. Read-only.
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": {
"filename": "<filename>"
},
"name": "read_document"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| page | No | Optional single page number to read (1-based, PDF only). If omitted, returns full text. | |
| pages | No | Optional page ranges to read (PDF only), e.g. "1-5", "10", "1-3,7,10-12". Overrides 'page' if both provided. | |
| offset | No | Character offset to start reading from (default 0). A truncated result ends with the offset of the next page. | |
| filename | Yes | The document filename to read | |
| max_chars | No | Maximum characters to return (default 50000, at most 200000). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | The text of this page of the document | |
| next_offset | No | Offset to pass on the next call; absent when this page reaches the end | |
| total_chars | Yes | Length of the whole text in characters |