Search Content
grepSearch file contents for text or regex patterns, returning matching lines. Scope with file globs, control case sensitivity, whole word matching, and include context lines. Optionally include hidden or ignored files.
Instructions
Search file contents for text (grep-like). Returns matching lines. Scope with filePattern (e.g. **/*.ts) to reduce noise. includeHidden=true for dotfiles.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | No | Base directory (default: root). Absolute path required if multiple roots. | |
| pattern | Yes | Search text. RE2 regex when `isRegex=true`. | |
| isRegex | No | Treat pattern as RE2 regex (no lookahead/lookbehind/backrefs). | |
| caseSensitive | No | Case-sensitive matching. Default: case-insensitive. | |
| wholeWord | No | Match whole words only | |
| contextLines | No | Include N lines of context before/after matches | |
| maxResults | No | Maximum match rows to return. Default: 500 | |
| filePattern | No | Glob for candidate files (e.g. "**/*.ts") | **/* |
| includeHidden | No | Include hidden items (starting with .) | |
| includeIgnored | No | Include ignored items (node_modules, etc). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| totalMatches | No | Total matches found | |
| truncated | No | Results truncated? | |
| resourceUri | No | Full results URI | |
| ok | Yes | ||
| matches | No | ||
| filesScanned | No | Files scanned | |
| filesMatched | No | Files with matches | |
| skippedTooLarge | No | Files skipped: too large | |
| skippedBinary | No | Files skipped: binary | |
| skippedInaccessible | No | Files skipped: inaccessible | |
| stoppedReason | No | Why search stopped |