Search inside a document
distill_searchFind where a word, number, or phrase appears in a local document or URL without reading it all; returns matching lines with page, heading, and context.
Instructions
Find where a word, number or phrase appears in one document without reading it: use it instead of reading a long document whole, and instead of shelling out to pdftotext or grep. Takes a local path (same formats as distill_file) or a url (same as distill_url); the document is converted once and the cached Markdown is searched. Matching is case-insensitive, ignores line wraps and extra whitespace, and finds numbers split across lines; set regex for a JavaScript regular expression (at most 200 characters; a regex that runs longer than 2 s is stopped with bad_request). Each hit has the line, the physical page number (1-based position in the PDF, not the printed label; absent for documents without pages), the nearest heading above it and a few lines of context; neighbouring matches are merged into one hit. Next step after a hit: read around it with distill_file using section (the hit's heading) or offset/limit (from the hit's line), or look at the original page with distill_page_image. Read-only: never modifies or uploads anything. A path stays on this machine; only a url reaches the internet (public pages only, with the safety rules of distill_url), which is why the tool is marked as open-world. Fails like distill_file or distill_url (password_protected, needs_libreoffice, forbidden, too_large over 100 MB for documents, 2 GB for audio and video, parse_failed, fetch_failed) or with bad_request (neither or both of path and url, an invalid or over-long regex, or one using lookarounds or backreferences).
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": {
"query": "<query>"
},
"name": "distill_search"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | No | Absolute http or https URL of a page. Pass either path or url | |
| path | No | Absolute path, or relative to the server's working directory. Pass either path or url | |
| query | Yes | Text to find. Plain text by default: case-insensitive, whitespace-insensitive, matches across line wraps | |
| regex | No | Treat query as an RE2 regular expression (case-insensitive, at most 200 characters; JavaScript-like syntax but no lookarounds or backreferences, always linear time) | |
| context | No | Lines of context before and after each match (default 2) | |
| maxHits | No | Maximum number of hits to return (default 20); total says how many there are |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| hits | Yes | ||
| note | No | ||
| total | Yes | ||
| tokens | Yes | ||
| truncated | Yes |