Grep Tool
Search file contents with regex. Uses ripgrep.
REQUIRED: pattern (regex pattern) OPTIONAL: path (directory/file), glob (file glob filter like "*.py"), ignoreCase (bool), literal (bool — treat pattern as literal text), context (lines of context before/after), limit (max matches, default 100)
RULES:
- Supports full regex syntax (unless
literal: true) - Use
globto filter by file type (e.g. ".py", ".js") - Use
limitto cap results; default 100 - Returns matching lines with file path and line number
- Good for finding function definitions, imports, references
EXAMPLE:
{"name": "Grep", "input": {"pattern": "def main", "glob": "*.py"}}
EXAMPLE with path:
{"name": "Grep", "input": {"pattern": "TODO|FIXME", "path": "/path/to/project/"}}
Workflow
- Simple search: Pass a regex pattern to search all files
- Filter by type: Use
globto limit to specific file extensions (e.g.,"*.py") - Scope search: Use
pathto limit to a directory or specific file - Add context: Use
contextto see lines before/after matches - Cap results: Use
limitto control output size (default 100)