search_and_replace
Finds and replaces text in target files, with options for case-sensitive search, replacing all occurrences, and creating backups.
Instructions
Search and replace text in target file.
Args: target_file: Path to target file search_pattern: Text to search for replacement: Replacement text case_sensitive: Whether search is case sensitive replace_all: Whether to replace all occurrences or just first create_backup: Whether to create backup file
Returns: Success message with replacement count
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": {
"target_file": "<target_file>",
"search_pattern": "<search_pattern>",
"replacement": "<replacement>"
},
"name": "search_and_replace"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| replace_all | No | ||
| replacement | Yes | ||
| target_file | Yes | ||
| create_backup | No | ||
| case_sensitive | No | ||
| search_pattern | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |