search_text
Locate matching lines across a file tree using regex or literal text, then list files, count matches, or replace content after previewing a dry-run diff.
Instructions
Grep a whole tree: regex (or literal) across files, returning only matching lines with file:line and optional context. Skips .git/node_modules/build dirs and binaries, honours .gitignore. Use files_only=true to just locate files, count_only=true for tallies. Set replace= to rewrite every match (dry_run=true first shows a diff).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| glob | No | Only these paths, as globs: ["*.ts","src/**/*.js"]. A pattern without "/" matches the basename at any depth. | |
| path | No | File or directory to search. Default: server cwd. | |
| word | No | Match whole words only. | |
| context | No | Lines of context on both sides of each match. | |
| dry_run | No | With replace: show the diff without writing. | |
| exclude | No | Globs to skip. | |
| literal | No | Treat pattern as plain text, not a regex. | |
| pattern | Yes | Regex to search for (JS syntax), or a literal string when literal=true. | |
| replace | No | Replacement text ($1 backrefs work). Rewrites the files unless dry_run=true. | |
| max_bytes | No | Byte cap on the returned text. Lower it to save tokens. | |
| max_depth | No | Recursion depth. Default 24. | |
| max_files | No | Stop after this many files with matches. Default 100. | |
| multiline | No | Let the pattern span lines (. matches newline). | |
| skip_dirs | No | Directory names not to enter (replaces the default list). | |
| count_only | No | Return just a match count per file. | |
| files_only | No | Return just the list of matching file paths — the cheapest mode. | |
| ignore_case | No | Case-insensitive match. | |
| max_results | No | Stop after this many matching lines. Default 200. | |
| show_hidden | No | Search dotfiles too. | |
| max_file_bytes | No | Skip files bigger than this. Default 2000000. | |
| respect_gitignore | No | Honour .gitignore. Default true. |