Ripgrep Search
searchFind file contents matching regex or literal patterns across codebases, with filters for file type, glob, depth, context, and multiline matches.
Instructions
Search file contents for a pattern using ripgrep. Supports regex, literal strings, multiline matching, OR matching via additionalPatterns, and various filtering options. For large or unfamiliar codebases, consider using search-count or search-files first to assess the scope of matches.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| glob | No | Glob pattern to filter files (e.g. '*.test.ts') | |
| path | Yes | Directory or file to search | |
| sortBy | No | Sort results by field | |
| pattern | Yes | Search pattern (regex by default) | |
| fileType | No | Filter by file type (e.g. 'ts', 'py') | |
| maxDepth | No | Maximum directory traversal depth | |
| noIgnore | No | Do NOT respect .gitignore rules (search files that are normally ignored) | |
| multiline | No | Enable multiline matching (for function signatures, import blocks, etc.) | |
| wordMatch | No | Only match whole words | |
| jsonOutput | No | Output in JSON Lines format | |
| maxColumns | No | Maximum display width per line (useful for minified files) | |
| maxResults | No | Maximum matches per file | |
| fileTypeNot | No | Exclude file type (e.g. 'json') | |
| invertMatch | No | Show lines that do NOT match the pattern | |
| afterContext | No | Lines of context after each match | |
| contextLines | No | Lines of context before and after each match. When beforeContext or afterContext are also specified, they override the respective side. | |
| fixedStrings | No | Treat pattern as a literal string instead of regex | |
| beforeContext | No | Lines of context before each match | |
| caseSensitive | No | true = case-sensitive, false = case-insensitive, omit = smart-case | |
| includeHidden | No | Include hidden files and directories | |
| maxCharacters | No | Maximum characters in the result. Truncated with summary if exceeded. | |
| followSymlinks | No | Follow symbolic links | |
| additionalPatterns | No | Additional patterns for OR matching. When fixedStrings is true, all patterns (including these) are treated as literal strings. |