search_code
Search code across all or selected repositories to locate matches by file and line, or return matched lines with surrounding context for review.
Instructions
Search code across repos. mode=locations (default) omits line text; mode=context includes context.
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": "search_code"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | "locations" (default) returns file+line number only; "context" also returns the matched line text and context_lines surrounding lines | locations |
| repo | No | Repo to search: "all" searches every configured repo; otherwise a single name or comma-separated list, e.g. "pypto,simpler" | all |
| query | Yes | Search term. Treated as a fixed string unless use_regex=True | |
| offset | No | Number of matching lines to skip before returning results | |
| file_glob | No | Filename glob filter, e.g. "*.py", "*.cc", "**/*.mlir". Default "*" matches all files. | * |
| use_regex | No | Treat query as a regular expression (ripgrep syntax). Default False uses fixed-string matching. | |
| max_results | No | Maximum number of match lines to return (1–2000) | |
| context_lines | No | Lines of context to include around each match. Only used when mode=context. | |
| group_by_file | No | When True, include a files[] list sorted by match count |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||