[codefix]
Applies one or more range edits to an open live document.
Editor and agent workflows often need preview-first writes and in-memory text to stay aligned while planning or validating edits.
The model can preview disk writes, preserve live document version guards, and keep semantic reads aligned with fresh edits.
Try it locally in the TGlider playground
| Name | Type | Required | Description |
|---|---|---|---|
| filePath | string | Yes | Workspace-relative or absolute file path. |
| expectedVersion | number | Yes | Current live document version expected before applying edits. |
| edits | json | Yes | Array of edits with startLine, startColumn, endLine, endColumn, and text. |
Apply a small in-memory edit
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "apply_document_edits",
"arguments": {
"filePath": "src/app.ts",
"expectedVersion": 1,
"edits": [
{
"startLine": 1,
"startColumn": 1,
"endLine": 1,
"endColumn": 1,
"text": "// note\n"
}
]
}
}
}Returns updated live document state and version metadata.