Browse documentation

apply_document_edits

[codefix]

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

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

Replace sample paths and symbol keys with values from your workspace.

Apply a small in-memory edit

Arguments
{
  "filePath": "src/app.ts",
  "expectedVersion": 1,
  "edits": [
    {
      "startLine": 1,
      "startColumn": 1,
      "endLine": 1,
      "endColumn": 1,
      "text": "// note\n"
    }
  ]
}
Full MCP request
Full MCP 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.