grep_pdf
Search text content within PDF files using regex or literal patterns, returning matching lines with page numbers and context, without page limitations.
Instructions
Search text in PDFs. Standard grep/rg does NOT work on PDFs (binary format). Use this tool instead. Returns matching lines with page numbers. NOTE: No page limit (unlike read_pdf's 10-page limit).
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": "grep_pdf"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pattern | Yes | Search pattern (regex by default) | |
| file_path | No | Specific PDF file. If not provided, searches ALL PDFs in working_directory | |
| working_directory | No | Base directory for search (only used when file_path is not provided) | . |
| ignore_case | No | Case-insensitive search | |
| fixed_strings | No | Treat pattern as literal string, not regex | |
| context | No | Lines of context before/after match (0-5, default: 2) | |
| max_count | No | Maximum matches to return (1-100) | |
| recursive | No | Include subdirectories when searching directory | |
| start_page | No | Start page (1-indexed, inclusive) | |
| end_page | No | End page (1-indexed, inclusive). None = last page |