ctx_search
Search project code by identifier or short query to get ranked, de-duplicated hits with paths, enclosing symbols and snippets under a token budget; use it instead of grep plus file reads.
Instructions
Ranked code search over the project (BM25 on identifier-split tokens; symbol names weigh most). Returns path:start-end, the enclosing symbol and a trimmed snippet for each hit, merged and de-duplicated, within budget_tokens. Use instead of grep + reading files. Expand a hit with ctx_symbol or ctx_read.
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": "ctx_search"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | What you are looking for: identifiers, or a short natural-language description. | |
| path_glob | No | Only files matching this glob, e.g. "src/**/*.ts" or "*.py". | |
| max_results | No | Most results to show (default 6). | |
| budget_tokens | No | Hard cap on the tokens returned (estimate; default 1500). |