patch_file
Replace exact text occurrences in a file with new content using atomic writes. Returns the number of replacements made.
Instructions
Apply a targeted patch to a file.
Finds all occurrences of old_str and replaces them with new_str.
Uses atomic write. Returns the number of replacements made.
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": {
"request": "<request>"
},
"name": "patch_file"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| request | Yes | Request model for patch_file tool. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | The path that was patched. | |
| new_size | Yes | File size after patch in bytes. | |
| old_size | Yes | File size before patch in bytes. | |
| replacements | Yes | Number of replacements made. |