Search Content
search_textSearch file contents for literal text or regex patterns, like grep. Returns matching lines with line numbers and paths.
Instructions
Search file contents for literal text or an RE2 regex, like grep; returns matching lines with line numbers and paths relative to the searched directory. Patterns match within one line. find_files matches file names.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | No | File to search, or directory to search under (default: the whole first allowed root). Naming a file searches that file alone: pattern is ignored and hidden/ignored filtering does not apply. | |
| cursor | No | Opaque pagination cursor; pass unchanged for the next page. Pages slice one snapshot taken on the first call; it expires after ~60s — re-request without a cursor if rejected. | |
| context | No | Lines of context to return either side of each match, like grep -C (default: 0, max: 10) | |
| isRegex | No | Treat searchPattern as a regex (default: literal text match) | |
| pattern | No | Glob to restrict search to specific file types (e.g. **/*.ts); default: all text files | |
| maxDepth | No | Max directory depth to scan; 0 = base directory only, omit for unlimited | |
| maxResults | No | Maximum number of matching lines to return per page | |
| caseSensitive | No | Enable case-sensitive matching (default: case-insensitive) | |
| includeHidden | No | Include hidden items (starting with .) | |
| searchPattern | Yes | Exact literal text or RE2 regex pattern to search for in file contents. When isRegex=true, uses RE2 syntax (no lookahead, lookbehind, or backreferences). Cannot be empty or whitespace-only. | |
| includeIgnored | No | Include ignored items (node_modules, .git, etc). |