Search Content
search_textSearch file contents for literal text or regex patterns, returning matching lines with file path, line number, and column offset. Use context and file-type filters to narrow results.
Instructions
Search file contents by text or regex (grep-style). Returns matching lines with file path, 1-indexed line number and 0-indexed column offset. Set context=N to also return N lines either side of each match (grep -C). Scope to specific file types with pattern (e.g. **/*.ts). Set includeHidden=true to include dotfiles. Use find_files to search by filename instead.
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). |