Grep
The Grep tool searches file contents using regular expression pattern matching. It is similar to the Unix grep command but optimized for use by the AI.
What It Does
Section titled “What It Does”- Searches one or more files for lines matching a pattern
- Supports regular expressions
- Returns matching lines with file paths and line numbers
- Can search recursively through directories
When It’s Used
Section titled “When It’s Used”The AI uses Grep when:
- It needs to find all usages of a function, variable, or symbol across a codebase
- You ask it to locate specific content in files
- It’s exploring a project and needs to understand how pieces connect
Example
Section titled “Example”“Find all places in this project where the
authenticatefunction is called.”
The AI will run a Grep search for authenticate across the relevant source files and report all occurrences with their file paths and line numbers.