search
Find cached files by keyword relevance using BM25 ranking. Supports natural-language queries and returns matches with a relevance score and optional preview.
Instructions
Find cached files by keyword relevance (BM25 ranking).
Searches only files already in the cache — seed them first with
read/batch_read (thin results usually mean too few files are cached).
Ranks by BM25 term relevance, so multi-word and keyword queries work
well; matching is lexical, not embedding-based, so synonyms won't match a
word that isn't present. For an exact string or regex use grep; to pull
more of the repo into the cache use batch_read. Returns matches with a
normalized 0–1 relevance score (best match = 1.0) and a short preview.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| k | No | Maximum number of matches to return. | |
| query | Yes | Keywords to rank by. Natural-language phrasing is fine, but ranking is on the individual words. | |
| directory | No | Restrict matches to files under this directory. | |
| show_preview | No | Include a short preview line for each match. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| k | No | ||
| count | No | ||
| query | No | ||
| matches | No | ||
| directory | No | ||
| truncated | No | ||
| cached_files | No | ||
| show_preview | No | ||
| files_searched | No |