Skip to main content
Glama

Undo a change

wp_undo
Destructive

Reverses one earlier WordPress change with its undo token, restoring posts, statuses, settings, builder pages, or themes; dry_run previews restores and blocks without changing data.

Instructions

Reverse one earlier change using its undo token (from the "undo" field of the original result, or from wp_undo_list): the fields of a post changed with wp_update_post, the statuses wp_bulk_update_status set, the site settings changed with wp_update_site_settings, the page-builder pages wp_update_builder_element and wp_search_replace changed, or the theme wp_activate_theme switched from (also through wp_install_theme_zip with activate). dry_run=true shows exactly what would be restored and what refused, without changing anything; wp_undo_discard drops a point without restoring it. Undoing needs the same permission as the original action, and each item is re-checked against the CURRENT state, so a post this account may no longer edit is reported as blocked rather than restored. An undo of a page-builder change (wp_update_builder_element, wp_search_replace) puts every stored copy of the page back byte for byte and refuses a page that someone has changed since — restoring would throw that newer work away — unless force=true. A fully successful undo consumes the token. A partial one consumes it too and returns rest_token, a new undo point with only what did not come back, so a later call retries just that; where nothing came back, the token is kept. A theme is switched back the way wp_activate_theme switches, with the same test requests: probe lists their result, and where the site does worse with the previous theme, the theme active before the undo is put back in the same call, the item is listed under failed with the reason, and the token is kept. Afterwards the page caches of the supported caching plugins are asked to purge the restored posts, and after an undo of site settings or of a theme every page of this site; page_cache_purged lists them, page_cache_skipped names a cache left out on a multisite network and why.

Input Schema

NameRequiredDescriptionDefault
forceNoPage-builder undo points only: true restores a page even where it was changed after the change being undone, which throws that later change away. Default false: such a page is reported as blocked (changed_since).
tokenYesThe undo token, e.g. undo_1a2b..., from the undo field of the original result or from wp_undo_list.
dry_runNotrue returns what the undo would restore and changes nothing. Default false.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv4.10.0

TDQS

A4.7/5.0
Behavior5/5

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

Far exceeds the annotations: it discloses that permission matches the original action, that each item is re-checked against current state, that mutations to page-builder pages are restored byte-for-byte and refused if changed since, token consumption rules (consumed on full success, rest_token on partial, kept on total failure), theme-probe rollback behavior, and cache purging. These are non-obvious behavioral traits an agent must know before calling a destructive tool.

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

Conciseness3/5

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

The purpose is front-loaded, but the body is a single dense run-on paragraph packing token lifecycle, permission checks, theme probing, and cache purging into one block. The information is mostly load-bearing, yet the lack of structure (no separation of preview, conflict, and return-value behaviors) makes it hard to scan.

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 no output schema, the description compensates by naming the return fields an agent will encounter: rest_token, failed with reasons, blocked/changed_since, page_cache_purged and page_cache_skipped. For a destructive, state-dependent operation this is complete.

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 baseline is 3, but the description adds real meaning: force is scoped to page-builder undo points only and explains the discard consequence, and the token's lifecycle (consumed, kept, or replaced by rest_token) is documented nowhere in the schema. The dry_run meaning is largely restated from 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 ('Reverse one earlier change using its undo token') and enumerates exactly which kinds of changes it can reverse (post fields, statuses, site settings, page-builder pages, theme switch). This lets an agent distinguish it from siblings like wp_restore_revision or wp_undo_discard.

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?

Explicitly routes usage: token comes from the original result's 'undo' field or wp_undo_list, dry_run is the preview path, and wp_undo_discard is named as the alternative when the agent wants to drop a point without restoring. The blocked/force condition is spelled out as a decision rule.

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