edit_file
Replace an exact string in a PHP file for targeted edits, with syntax checking before disk write so parse errors reject broken changes.
Instructions
Edit a file by replacing an exact string. old_string must match exactly and uniquely unless replace_all is true. The preferred way to change an existing .php file — a targeted replacement can't corrupt the surrounding file the way a full rewrite can. Result is syntax-checked before it touches disk; a broken edit is rejected with the parse error instead of being saved.
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": {
"path": "<path>",
"old_string": "<old_string>",
"new_string": "<new_string>"
},
"name": "edit_file"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | ||
| new_string | Yes | ||
| old_string | Yes | ||
| replace_all | No |