searchAndReplace
Find and replace text or regex patterns across workspace files with support for capture groups, file glob filtering, and dry-run previews.
Instructions
Find and replace across workspace files. Supports regex with capture groups. Returns modified files.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"pattern": "<pattern>",
"replacement": "<replacement>"
},
"name": "searchAndReplace"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| glob | No | File glob pattern to limit scope (e.g. '**/*.ts', 'src/**/*.py'). Omit to search all text files. | |
| dryRun | No | Preview changes without writing files. Default: false. | |
| isRegex | No | Treat pattern as a JavaScript regex. Default: false (literal string match). | |
| pattern | Yes | Text or regex pattern to search for | |
| replacement | Yes | Replacement text. For regex mode, supports $1, $2, etc. capture group references. | |
| caseSensitive | No | Case-sensitive match. Default: true. | |
| includeIgnored | No | Search inside .gitignored files (e.g. node_modules, build output). Default: false. |