search_code
Search codebases by text or regex to locate matching file paths, line numbers, and content. Narrow results by directory, file type, whole word, case sensitivity, or context lines.
Instructions
Fast text or regex search across the entire codebase. Uses ripgrep for speed. Returns file paths, line numbers, and matched content. Works with any programming language.
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": {
"pattern": "<pattern>"
},
"name": "search_code"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pattern | Yes | Search pattern (text or regex) | |
| is_regex | No | Treat pattern as regex (default: false) | |
| directory | No | Subdirectory to search within | |
| file_glob | No | Filter by file pattern, e.g. "*.py", "*.ts", "*.java" | |
| whole_word | No | Match whole words only (default: false) | |
| max_results | No | Maximum results to return (default: 50) | |
| context_lines | No | Lines of context before/after each match (default: 0) | |
| case_sensitive | No | Case-sensitive search (default: false) |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| total | Yes | ||
| matches | Yes |