Skip to main content
Glama

undo_last

Reverses your last n changes from this session, restoring exact prior state after a wrong-condition commit, bad batch edit, or accidental shape delete. Only gestures that modified data count.

Instructions

Step back over your OWN last n mutations, newest first — a committed measure_polygon, an edit_shape, a delete_shape, an edit_materials call, an edit_condition call, or an RFI verb (create_rfi / resolve_rfi / delete_rfi). Each step is reversed exactly (a commit is removed, an edit is restored verbatim, a delete is re-inserted where it was, a materials edit's whole array is restored, a condition edit's waste/multiplier pair is restored), so this restores state rather than approximating it. Reads are never journaled, so n counts gestures that changed something, not tool calls you made. Use it when a sweep committed against the wrong condition or a batch went in on the wrong sheet — one call instead of N deletes. Scope: this session's own history only. It is not the browser canvas's undo stack, and load_plan clears it along with the shapes it refers to.

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": "undo_last"
  }
}

Input Schema

NameRequiredDescriptionDefault
nNoHow many steps to reverse (1–100)

Output Schema

NameRequiredDescriptionDefault
noteNo
stepsYesNewest first
undoneYesSteps actually reversed
remainingYesSteps still available to undo
shape_countYesCommitted shapes after the undo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed11 schema fields changedv0.1.31
    • removedInput schema / additionalProperties
      Removed value: -false
    • addedOutput schema / properties / remaining / maximum
      Added value: +9007199254740991
    • addedOutput schema / properties / remaining / minimum
      Added value: +-9007199254740991
    • addedOutput schema / properties / shape_count / maximum
      Added value: +9007199254740991
    • addedOutput schema / properties / shape_count / minimum
      Added value: +-9007199254740991
    • addedOutput schema / properties / steps / items / properties / seq / maximum
      Added value: +9007199254740991
    • addedOutput schema / properties / steps / items / properties / seq / minimum
      Added value: +-9007199254740991
    • addedOutput schema / properties / steps / items / properties / shapes / maximum
      Added value: +9007199254740991
    • addedOutput schema / properties / steps / items / properties / shapes / minimum
      Added value: +-9007199254740991
    • addedOutput schema / properties / undone / maximum
      Added value: +9007199254740991
    • addedOutput schema / properties / undone / minimum
      Added value: +-9007199254740991
  2. Changed1 schema field changedv0.1.29
    • changedOutput schema / properties / steps / items / properties / op / enum
      Previous value: -[
      -  "commit",
      -  "scale",
      -  "edit",
      -  "annotation_text",
      -  "delete",
      -  "materials",
      -  "condition",
      -  "approval",
      -  "duplicate_condition",
      -  "split_condition",
      -  "cutout",
      -  "cutout_restore",
      -  "runcut",
      -  "rfi_create",
      -  "rfi_resolve",
      -  "rfi_delete",
      -  "proposal_open",
      -  "proposal_revise",
      -  "proposal_withdraw",
      -  "condition_proposal",
      -  "condition_proposal_withdraw",
      -  "condition_proposal_accept"
      -]New value: +[
      +  "commit",
      +  "scale",
      +  "edit",
      +  "annotation_text",
      +  "delete",
      +  "materials",
      +  "condition",
      +  "approval",
      +  "duplicate_condition",
      +  "split_condition",
      +  "cutout",
      +  "cutout_restore",
      +  "runcut",
      +  "rfi_create",
      +  "rfi_resolve",
      +  "rfi_delete",
      +  "proposal_open",
      +  "proposal_revise",
      +  "proposal_withdraw",
      +  "condition_proposal",
      +  "condition_proposal_withdraw",
      +  "condition_proposal_accept",
      +  "pricing",
      +  "estimate_settings"
      +]
  3. Changed1 schema field changedv0.1.21
    • changedOutput schema / properties / steps / items / properties / op / enum
      Previous value: -[
      -  "commit",
      -  "edit",
      -  "delete",
      -  "materials",
      -  "condition",
      -  "approval",
      -  "duplicate_condition",
      -  "split_condition",
      -  "cutout",
      -  "cutout_restore",
      -  "runcut"
      -]New value: +[
      +  "commit",
      +  "scale",
      +  "edit",
      +  "annotation_text",
      +  "delete",
      +  "materials",
      +  "condition",
      +  "approval",
      +  "duplicate_condition",
      +  "split_condition",
      +  "cutout",
      +  "cutout_restore",
      +  "runcut",
      +  "rfi_create",
      +  "rfi_resolve",
      +  "rfi_delete",
      +  "proposal_open",
      +  "proposal_revise",
      +  "proposal_withdraw",
      +  "condition_proposal",
      +  "condition_proposal_withdraw",
      +  "condition_proposal_accept"
      +]
  4. Changed1 schema field changedv0.1.19
    • changedOutput schema / properties / steps / items / properties / op / enum
      Previous value: -[
      -  "commit",
      -  "edit",
      -  "delete",
      -  "materials",
      -  "condition",
      -  "approval",
      -  "duplicate_condition",
      -  "split_condition",
      -  "cutout",
      -  "cutout_restore"
      -]New value: +[
      +  "commit",
      +  "edit",
      +  "delete",
      +  "materials",
      +  "condition",
      +  "approval",
      +  "duplicate_condition",
      +  "split_condition",
      +  "cutout",
      +  "cutout_restore",
      +  "runcut"
      +]
  5. Changed1 schema field changedv0.1.15
    • changedOutput schema / properties / steps / items / properties / op / enum
      Previous value: -[
      -  "commit",
      -  "edit",
      -  "delete",
      -  "materials",
      -  "condition",
      -  "approval",
      -  "duplicate_condition",
      -  "split_condition"
      -]New value: +[
      +  "commit",
      +  "edit",
      +  "delete",
      +  "materials",
      +  "condition",
      +  "approval",
      +  "duplicate_condition",
      +  "split_condition",
      +  "cutout",
      +  "cutout_restore"
      +]
  6. Changed1 schema field changedv0.1.14
    • changedOutput schema / properties / steps / items / properties / op / enum
      Previous value: -[
      -  "commit",
      -  "edit",
      -  "delete",
      -  "materials",
      -  "condition",
      -  "approval"
      -]New value: +[
      +  "commit",
      +  "edit",
      +  "delete",
      +  "materials",
      +  "condition",
      +  "approval",
      +  "duplicate_condition",
      +  "split_condition"
      +]
  7. Changed2 schema fields changedv0.1.12
    • changedOutput schema / properties / steps / items / properties / op / enum
      Previous value: -[
      -  "commit",
      -  "edit",
      -  "delete",
      -  "materials",
      -  "condition"
      -]New value: +[
      +  "commit",
      +  "edit",
      +  "delete",
      +  "materials",
      +  "condition",
      +  "approval"
      +]
    • changedOutput schema / properties / steps / items / properties / shapes / description
      Previous value: -"Shapes affected by reversing this step — 0 for a materials step (it restores a condition's supporting-materials rows, not shapes) and for a condition step (it restores the waste/multiplier pair)"New value: +"Shapes affected by reversing this step — 0 for a materials step (it restores a condition's supporting-materials rows, not shapes), for a condition step (it restores the waste/multiplier pair), and for an approval step (it re-seats or removes a verdict mark)"
  8. Changed2 schema fields changedv0.1.8
    • changedOutput schema / properties / steps / items / properties / op / enum
      Previous value: -[
      -  "commit",
      -  "edit",
      -  "delete",
      -  "materials"
      -]New value: +[
      +  "commit",
      +  "edit",
      +  "delete",
      +  "materials",
      +  "condition"
      +]
    • changedOutput schema / properties / steps / items / properties / shapes / description
      Previous value: -"Shapes affected by reversing this step — 0 for a materials step (it restores a condition's supporting-materials rows, not shapes)"New value: +"Shapes affected by reversing this step — 0 for a materials step (it restores a condition's supporting-materials rows, not shapes) and for a condition step (it restores the waste/multiplier pair)"
  9. Addedv0.1.6

TDQS

A4.6/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations supplied, the description carries the full behavioral burden and does most of it: it discloses the exact reversal semantics per operation ('a commit is removed, an edit is restored verbatim, a delete is re-inserted where it was'), that reads are never journaled, and that load_plan clears the history. Remaining gaps are error behavior when n exceeds the journal length and whether an undo is itself journaled (i.e. whether undo can be undone), which matters for a state-mutating tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The definition is front-loaded with the action and scope, then proceeds to reversal semantics, trigger conditions, and limits, so a reader can stop early if needed. It is dense rather than padded, though the long parenthetical cataloguing per-operation reversal behavior is heavier than strictly necessary for selection purposes.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

An output schema exists, so return values need no explanation, and the description instead covers the things structured fields cannot: journal scope, what counts as a step, exact restoration guarantees, and the load_plan interaction. For a single-optional-parameter tool with an output schema, nothing an agent needs in order to call it correctly is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% and the schema already documents n's range and default, so the baseline would be 3. The description adds non-obvious semantics the schema cannot express: 'n counts gestures that changed something, not tool calls you made,' which prevents a common off-by-N mistake for an agent that made intervening read calls.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a specific verb plus resource and scope: 'Step back over your OWN last n mutations, newest first.' It then enumerates exactly which operations fall inside that scope (measure_polygon commit, edit_shape, delete_shape, edit_materials, edit_condition, RFI verbs), so an agent can tell precisely what this tool covers without opening the schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It gives explicit triggering conditions ('when a sweep committed against the wrong condition or a batch went in on the wrong sheet') and names the alternative it replaces ('one call instead of N deletes'). It also sets hard exclusions: 'this session's own history only' and 'It is not the browser canvas's undo stack.' That is when-to-use, when-not-to-use, and a stated alternative in three sentences.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.