apply_edit
Apply file edits using either workspace edits from rename/format operations or text matching with whitespace normalization for accurate replacements.
Instructions
Apply an edit to a file. Two modes: (1) WorkspaceEdit mode — pass workspace_edit with positional changes returned by rename_symbol or format_document; (2) Text-match mode — pass file_path + old_text + new_text to find and replace text without needing line/column positions. Text-match tries exact match first, then whitespace-normalised line match (handles indentation differences). Use text-match when AI-generated positions would be imprecise.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "apply_edit"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| new_text | No | ||
| old_text | No | ||
| file_path | No | ||
| workspace_edit | No |