grep
Search code structurally across files or directories, with AST-aware grouping by class/function and filtering of comments and strings. Automatically detects regex patterns.
Instructions
AST-aware structural search across a file or directory. Matches are grouped by enclosing class/function, with kind tags [def]/[import]. Comment/string noise is filtered by default. Regex is auto-detected.
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>",
"path": "<path>"
},
"name": "grep"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| kind | No | Narrow results by classification kind | |
| path | Yes | Absolute path to search | |
| count | No | Show match counts per file (-c) | |
| pattern | Yes | Search pattern (literal or regex, auto-detected) | |
| maxCount | No | Maximum number of matches per file (-m) | |
| filesOnly | No | List matching files only (-l) | |
| wordMatch | No | Match whole words only (-w) | |
| caseInsensitive | No | Case-insensitive matching (-i) |