Search book content
search_book_contentSearches the text of one book or one poem for passages about a topic, by meaning rather than exact words, and returns the passages with page and chapter (books) or the line and its neighbours (poems), plus a relevance score.
Use when the user asks to find a passage, a scene, or what a book or poem says about something, in a book or poem already identified by id (from search_books, get_reading_history or get_currently_reading). For the text around the page the reader has reached, without a topic, use get_passages_near_reading_position.
Book text is available only for books the reader uploaded their own copy of in the ReadingRate app; for other books the result says the text is not available. Poems are always searchable.
Spoiler protection is on by default for books: for a book on the reader's want-to-read list no passages are returned, and for a book they are reading only pages up to their logged position are searched. If no position is logged, the whole book is searched, unless spoiler_protection is set to true, in which case passages are withheld and the result says so. Finished books are searched in full. Set spoiler_protection to false to search the whole book.
Examples:
{"query": "marriage", "book_id": ""}
{"query": "the hunt", "poem_id": "whoso-list-to-hunt"}
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum number of passages (default 5, max 10) | |
| query | Yes | What to look for, in words, e.g. "passages about memory" | |
| book_id | No | The book to search: its ReadingRate id or library entry id. Give this or poem_id. | |
| poem_id | No | The poem to search: its anchor or slug, as for get_poem. Give this or book_id. | |
| spoiler_protection | No | Search only pages the reader has reached (default true). With no logged position, true withholds passages and the default searches the whole book. Not used for poems. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | The search query that was run | |
| message | No | Present when no passages were found: explains why | |
| passages | Yes | Matching passages ordered by relevance | |
| results_count | Yes | Number of passages returned | |
| filtered_to_book | No | Present when book_id was provided: the resolved book | |
| spoiler_protection | No | Present when spoiler protection was applied or explicitly requested |