Get Internet Archive Item Text
ia_get_textRetrieve readable OCR DjVuTXT or plain text from an Internet Archive item, including public-domain books, documents, scanned periodicals, and transcripts. Each call reads one text file: the one file names, or by default the first DjVuTXT file (else Text, Plain Text, or another .txt file). An item can hold several, such as one per volume; a notice then gives the count. Set max_chars for page size, then pass next_continuation as continuation with the same identifier and omit char_offset. Direct char_offset access remains available. To jump to a passage, pass find with a phrase: the page starts at its first match at or after char_offset or the continuation's position, and match_offset reports where; that page's next_continuation, passed back with the same find, searches on from the page's end. To list the DjVuTXT files of an item, call ia_get_item with format "DjVuTXT".
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": {
"identifier": "<identifier>"
},
"name": "ia_get_text"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file | No | The text file to read, named exactly as ia_get_item lists it, e.g. "Strabo 02 Geography 3-5_djvu.txt". It must be readable text: format DjVuTXT, Text, or Plain Text, or a .txt name whose format is not Metadata. Omit to read the default: the first DjVuTXT file, else Text, else Plain Text, else another .txt file. With continuation, omit it or name the file the continuation reads; blank is omitted. | |
| find | No | A literal phrase of at most 500 characters to find in the file read; the page then starts at its first match at or after char_offset or the continuation's position. Letters match regardless of case, one character to one (ß never matches ss); a whitespace run in the phrase matches any whitespace run in the text, line breaks included; every other character matches itself. OCR misreads and words hyphenated across line ends break a phrase, so prefer a short, distinctive one. Blank is omitted. | |
| max_chars | No | Maximum number of characters to return in this response. Defaults to the server-configured maximum (IA_MAX_SNAPSHOT_CHARS, typically 50 000); a larger value is served at that maximum, with a notice. Lower values reduce token usage. | |
| identifier | Yes | Internet Archive item identifier, e.g. "prideprejudice00aust" (Pride and Prejudice), from ia_search_items results; or an archive.org item URL, such as https://archive.org/details/prideprejudice00aust or its download, stream, metadata, or embed form, read as the identifier it names. A download, stream, or storage-node URL naming a file reads that file when file is omitted. | |
| char_offset | No | Character offset to start reading from (default 0); with find, where the search starts. For sequential pages use next_continuation as continuation instead. Omit char_offset when using continuation. | |
| continuation | No | Opaque next_continuation from the previous page. Omit char_offset when using it; blank is omitted. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | No | The text slice starting at char_offset up to max_chars characters. | |
| error | No | Present when the call failed. Absent on success. | |
| notice | No | Explains a max_chars clamp or why efficient continuation is unavailable, with the next char_offset or end-of-document status; that find matched nothing from char_offset to the end of source_file; or — when file was omitted — how many readable text files the item holds and how to list them. | |
| has_more | No | True when there is more text beyond this slice. Use next_continuation, or add max_chars to char_offset if no token is available. | |
| max_chars | No | Maximum characters this response could hold — the requested max_chars, or the server maximum when the request exceeded it. | |
| char_offset | No | Character offset used for this response: with find, where its first match begins (equal to match_offset), or where the search started when nothing matched. | |
| source_file | No | Filename of the source text file fetched from the item. | |
| match_offset | No | With find, the character offset where its first match begins, equal to char_offset. Omitted when find matched nothing or was not given. | |
| next_continuation | No | Opaque next-page token; use as continuation with the same identifier and omit char_offset. Expires after one hour. | |
| source_file_bytes | No | Size of the source text file in bytes, from the item manifest — a byte count, not a character count (non-ASCII text takes several bytes per character). Omitted when the manifest lists no size. |