grep
Search file contents using regular expressions or literal text, with optional glob filters, case-insensitive matching, and result limits to locate code patterns or TODO items.
Instructions
Search file contents with a regular expression (or a literal string).
pattern is a Python re regular expression matched against each line
with re.search -- it is not a shell grep command. Use | to combine
alternatives, .* for wildcards, and groups/quantifiers such as
(foo|bar) or \w+. \| matches a literal pipe character, so do
not escape | to mean "or" (GNU grep basic-regex syntax is not used).
For example::
grep(pattern="def (load|save)_config|class .*Settings|TODO.*(refactor|migrate)", glob_filter="*.py")Set literal=True to match plain text with no regex interpretation. Use
ignore_case for case-insensitive matching and max_results to cap
output; there is no shell pipeline to pipe into head.
Args:
pattern: Regular expression (Python re syntax), or literal text
when literal is true. Combine alternatives with unescaped |.
path: File or directory to search (absolute or root-relative, default root).
glob_filter: Optional filename filter, e.g. *.py.
literal: Treat pattern as plain text instead of a regex (default false).
ignore_case: Case-insensitive matching (default false).
max_results: Cap on returned matches (default 100).
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": "grep"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | No | . | |
| literal | No | ||
| pattern | Yes | ||
| glob_filter | No | ||
| ignore_case | No | ||
| max_results | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |