search_code
Search a code repository using exact/regex text matching or natural-language queries. Returns matching lines or symbols with file and line numbers.
Instructions
Search the repo, filtered and paginated. mode='lexical' does exact/regex text matching; mode='semantic' ranks symbols by natural-language meaning ("where is auth handled?").
Returns file:line plus the matching line (lexical) or matched symbol (semantic).
Use this when you do NOT know the exact symbol name. Prefer find_symbol /
find_references when you DO — they are structural and far more precise.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Text or regex to search for. | |
| mode | No | 'lexical' (default, exact/regex) or 'semantic' (natural-language meaning; requires the optional 'semantic' extra). | lexical |
| regex | No | Treat query as a regular expression. | |
| path_glob | No | Restrict to paths matching a glob, e.g. '*/api/*.py'. | |
| case_sensitive | No | Case-sensitive match. | |
| limit | No | Max hits to return. | |
| offset | No | Pagination offset. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |