Skip to main content
Glama

media_undo_replace

Reverts the last file replacement for a WordPress media attachment when can_undo_replace is true. Use it to restore the previous file version after an unintended replace.

Instructions

Undo the last file replace of one attachment (needs edit rights on the attachment). Only possible while can_undo_replace is true in media_get_attachment.

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": {
      "site": "<site>",
      "id": "<id>"
    },
    "name": "media_undo_replace"
  }
}

Input Schema

NameRequiredDescriptionDefault
idYesAttachment id
siteYesSite id (see list_sites)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv3.14.0

TDQS

A4/5.0
Behavior4/5

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

With no annotations provided, the description carries the full burden and does well: it discloses that this is a mutation, that it requires edit rights, that only the most recent replace can be undone (one level of history), and that availability is gated by a can_undo_replace flag. It does not say what state the attachment returns to, whether the replaced file is discarded, or how failure is reported when the flag is false.

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

Conciseness5/5

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

Two short sentences, zero filler. The action is front-loaded and the constraint plus prerequisite follow immediately, in the order an agent needs them.

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

Completeness4/5

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

For a two-parameter mutation with no output schema and no annotations, the definition covers the essentials: what it does, the permission requirement, and the gating condition checked via another tool. Only the post-condition (what the attachment looks like after undo) and error behaviour are left unstated, which is a modest gap rather than a blocking one.

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

Parameters3/5

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

Schema description coverage is 100%, so the id and site parameters are already documented in the schema and the baseline is 3. The description adds only the notion that the id refers to the attachment whose replace is undone, which the schema's 'Attachment id' already conveys; the site parameter's pointer to list_sites is schema-side, not description-side.

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

Purpose4/5

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

States a specific verb and resource: 'Undo the last file replace of one attachment'. The scope is narrowed to a single attachment and a single prior replace, which is precise. It does not explicitly differentiate itself from near-neighbours like media_restore_attachment or media_cleanup_backups, so an agent must infer that this undoes a replace rather than a deletion or a backup restore.

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 an explicit precondition and effectively a when-not rule: the operation is only possible while can_undo_replace is true in media_get_attachment, and it names that sibling as the place to check first. It also states the permission requirement (edit rights on the attachment). It stops short of naming alternative tools for the case where undo is not available.

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

Deploy Server

Other Tools