apply_document_edits

[codefix]

Applies one or more range edits to an open live document.

Why this tool exists

Editor and agent workflows often need preview-first writes and in-memory text to stay aligned while planning or validating edits.

How it helps the agent

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

Parameters

NameTypeRequiredDescription
filePathstringYesWorkspace-relative or absolute file path.
expectedVersionnumberYesCurrent live document version expected before applying edits.
editsjsonYesArray of edits with startLine, startColumn, endLine, endColumn, and text.

Examples

Apply a small in-memory edit

Request
{
  "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"
        }
      ]
    }
  }
}

Response Notes

Returns updated live document state and version metadata.

↑/↓ NavigateEnter OpenSpace Expand