Find in book
find_in_bookLocate every occurrence of a word or phrase in a Project Gutenberg book, returning total counts, per-chapter counts, and sample matches with line numbers and context.
Instructions
Find every occurrence of a word or phrase in a Project Gutenberg book. Returns the total count, per-chapter counts, and the first matches with line numbers and surrounding lines. Ignores case, quote style, dash style and line breaks.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Project Gutenberg book id, e.g. 2701 (Moby Dick) or 1342 (Pride and Prejudice). Find ids with search_books. | |
| query | Yes | Word or phrase to find, e.g. "white whale". Case, curly vs straight quotes, dash style and line breaks are ignored. | |
| whole_word | No | Only match whole words ("whale" will not match "whales"). Default false. | |
| max_results | No | Matches to return with context (1-20, default 10). total_matches always counts all of them. | |
| context_lines | No | Lines of context before and after each match (0-5, default 1). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | ||
| note | No | ||
| query | Yes | ||
| matches | Yes | ||
| returned | Yes | ||
| by_chapter | Yes | Match counts per chapter, in book order (chapters with no matches left out). | |
| attribution | Yes | Credit line to keep with any quoted text. | |
| total_matches | Yes |