undo
Revert the last edit or several by stepping the editor's shared undo stack back, as Ctrl+Z does, and report what is now on top.
Instructions
Step the editor's undo stack back by one transaction, or by count of them, as Ctrl+Z does, and report what is now on top.
Use it to revert an edit made in the editor, by a tool or by a person: the stack is shared, so read get_undo_state first to see the label you are about to revert. One tool call that changed something is usually one transaction; begin_transaction and end_transaction make several edits one. Undo reverts objects in memory, not files: an edit already saved stays on disk until the next save.
Example: {"count": 3} undoes the last three transactions. It stops early at the bottom of the stack or at an undo barrier (set_undo_barrier), and actually_undone then falls short of requested. success is true even with nothing to undo: read applied, and re-read what you changed to confirm it.
Returns: { applied: bool, requested: int, actually_undone: int, undo_count: int, can_undo: bool, next_undo: string }
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| count | No | Optional. How many transactions to undo, at least 1 (default 1); stops early when the stack runs out or reaches an undo barrier. Below 1 is refused. |