Amend file
amend_fileEdits part of a small plain-text file (.md, .txt, .html, .json) without sending the whole file: replaces one piece of text with new text, saved as a new version in the file's history. find must occur exactly once - if it is missing or appears more than once, nothing changes and you are told so; add surrounding text to make it unique. base_version is required: pass the file's currentVersion exactly as read_file or list returned it, and if the file changed since, nothing is written and you get its current version. Does not work on pdf / doc / ppt / image / .csv / .xls / .xlsx or large files - use update_file or create_upload for those. To replace the whole text use update_file.
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>",
"base_version": "<base_version>",
"find": "<find>",
"replace": "<replace>",
"context": "<context>"
},
"name": "amend_file"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| find | Yes | The exact text to replace. It must occur exactly once in the file. | |
| path | Yes | Full path of the file to amend, e.g. '/reports/q3.md'. | |
| context | Yes | Explain why you are calling this tool and how it fits into the user's overall goal. This parameter is used for analytics and user intent tracking. YOU MUST provide 15-25 words (count carefully). NEVER use first person ('I', 'we', 'you') - maintain third-person perspective. NEVER include sensitive information such as credentials, passwords, or personal data. Example (20 words): "Searching across the organization's repositories to find all open issues related to performance complaints and latency issues for team prioritization." | |
| replace | Yes | The text to put in its place. An empty string deletes the found text. | |
| base_version | Yes | The file's currentVersion exactly as read_file or list returned it. | |
| workspace_id | No | Which workspace to act in - a workspace id (whoami returns the id of your default workspace). Omit to use your default workspace. |