Skip to main content
Glama

undo_run

Destructive

Revert an agent run in one atomic commit: undo its edits, remove created docs, and restore moved or deleted files, with optional commit or path scoping and a dry-run preview.

Instructions

Undo a run (an id from agent_runs) in one commit, all or nothing: its edits reverted, the docs it created removed, those it moved or deleted put back. from keeps the run up to that commit and undoes the rest; paths undoes only those docs. Refused, with nothing changed, if a later change touches the same lines. Only the person the run was for may, or someone with the rights each change takes by hand. dry_run=true lists what it would revert.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "run": "<run>",
      "ai": "<ai>"
    },
    "name": "undo_run"
  }
}

Input Schema

NameRequiredDescriptionDefault
aiYesYour AI family in lowercase (claude, chatgpt, gemini), not the model name. Attributes the change.
runYesThe run id, from agent_runs.
fromNoA commit sha from the run's `log`: undo it and every later commit of the run, keep the earlier ones.
pathsNoUndo only these docs, as the run lists them; the rest of the run stays.
dry_runNoList what would be reverted; change nothing.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv2.8.0
    • changedInput schema / properties / paths / description
      Previous value: -"Undo only these docs."New value: +"Undo only these docs, as the run lists them; the rest of the run stays."
  2. First observedv2.7.0

TDQS

A4.6/5.0
Behavior5/5

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

Annotations already flag destructiveHint=true and openWorldHint=false, and the description adds substantial context on top: atomicity, refusal semantics with no partial changes, permission rules (run owner or equivalent per-change rights), and dry_run preview behavior. This is exactly the extra behavioral detail annotations cannot convey.

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?

Front-loaded with the core action and effects, then variant behavior, then refusal and permission conditions. It is dense and a few clauses (the permission sentence) are compressed to the point of needing a re-read, but nothing is filler.

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?

For a 5-parameter destructive mutation with no output schema, the definition covers effects, atomicity, refusal modes, authorization, and preview. An agent could decide and invoke correctly without opening anything else.

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%, so the baseline is 3; the description earns more by explaining how `from` and `paths` interact with the run's scope ('keeps the run up to that commit and undoes the rest', 'undoes only those docs'). The `ai` parameter's attribution role is left entirely to the schema.

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?

States a specific verb and resource (undo a run from agent_runs) and immediately enumerates the concrete effects: edits reverted, created docs removed, moved/deleted docs restored. The atomic 'all or nothing' framing distinguishes it from a per-document revert like doc_revert.

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

Usage Guidelines4/5

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

Gives real when-to-use structure: `from` for partial rollback up to a commit, `paths` for doc-scoped undo, dry_run for preview, plus a clear when-not (refused if a later change touches the same lines, with nothing changed). It stops short of naming an alternative sibling to use instead, so not a full 5.

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