Search
searchRetrieve cached files ranked by keyword relevance (BM25). Multi-word queries return matches with normalized scores and previews, helping you locate previously indexed content.
Instructions
Find cached files by keyword relevance (BM25 ranking).
Searches only files already in the cache — index them first with warm,
which returns counts rather than content (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. Terms are OR'd — a word the corpus happens not to
contain costs you ranking, not the whole result set. 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. The cache is shared across projects, so a search with
no directory ranks the current project only; name one to look elsewhere.
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. Defaults to the project root. | |
| show_preview | No | Include a short preview line for each match. |