Skip to main content
Glama

Undo the last write

undo_last_write
Destructive

Restores a file to its state before the tracker server's last write, preventing lost edits by refusing if the file changed since then.

Instructions

Restore the file to its state before this server's last write. Refused if the file has changed since that write (it would lose someone else's edits).

The tool writes only with the user's yes. The client may ask in its own confirmation dialog. Otherwise call with dry_run=true, show the preview to the user, and after they agree in a new message repeat the same call with confirm=. The write is refused if the tracker changed since expected_version.

Input Schema

NameRequiredDescriptionDefault
confirmNoToken from the dry run the user approved. Not needed when the client shows the server's confirmation dialog
dry_runNoOnly show what would change, plus the confirm token; write nothing
expected_versionNo`version` from your last read; the write is refused if the file changed since

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.5.1

TDQS

A4.8/5.0
Behavior5/5

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

Annotations already flag destructive/non-idempotent, but the description adds real behavior: the write is refused if the file changed since the last write, refusal also occurs if the tracker moved past expected_version, and the confirm token must come from a user-approved dry run. These are workflow-critical traits no annotation conveys.

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?

Purpose is front-loaded and every sentence carries operational content. Minor redundancy: the closing line about the tracker changing since expected_version restates the earlier file-changed refusal, and 'the write is refused' appears twice.

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?

With an output schema present and annotations covering the safety profile, the description needn't explain return values; it instead covers the confirmation protocol, refusal conditions, and version guard — everything an agent needs to call this destructive undo safely.

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, but the description goes further by tying confirm, dry_run, and expected_version into a concrete approval workflow rather than restating field meanings. It stops short of naming token lifetime or reuse rules.

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 first sentence states a specific verb and resource with scope: 'Restore the file to its state before this server's last write.' That is unambiguously distinct from sibling listing tools like recent_writes or describe_tracker, and an agent can pick it 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 spells out two mutually exclusive invocation paths — client-side confirmation dialog, or dry_run=true then repeat with confirm=<token> after the user agrees in a new message — and states the precondition (expected_version) that causes refusal. When-to-use and when-not are both explicit.

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