page_grep
Find text inside a page's HTML, saved text, or PDF range using regex or literal matching, returning line numbers with context for precise follow-up reads and edits.
Instructions
Find text inside one page's HTML or a file page's saved text, like grep -n on a file. PDFs search embedded text in the selected pdfPage/pdfLimit range (default page 1), with document page markers; check pdf.nextPage and truncatedPages before concluding there are no matches in the document. Returns matching lines with their line numbers (12: a match, 11- context, -- between hunks), so you can page_read a window around them with offset/limit or copy an exact oldString for page_patch (HTML pages only). Leave the number prefix out of oldStrings. pattern is a JavaScript regex unless literal is true. Works on open and closed pages. To find which page has something, use library_search instead.
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": {
"pattern": "<pattern>"
},
"name": "page_grep"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | No | Tab id, e.g. t_ab12cd34. | |
| key | No | Page key, e.g. scribe:sprint-notes (the scribe: prefix is optional). | |
| context | No | Lines of context before and after each match (0–20). Default 0. | |
| literal | No | Match pattern as plain text, not a regex. | |
| pattern | Yes | Regex (JavaScript syntax) matched against each line, or plain text with literal: true. | |
| pdfPage | No | PDF only: first document page to search, 1-based. Default 1; returned pdf.nextPage continues. | |
| pdfLimit | No | PDF only: document pages to search (1–5). Default 1. Searches embedded text up to 20,000 characters per page; check pdf.truncatedPages and pdf.nextPage. | |
| ignoreCase | No | Case-insensitive match. | |
| maxMatches | No | Show at most this many matches. Default 50; the total is still counted. |