Skip to main content
Glama

Remove a widget

wp_delete_widget
Destructive

Permanently remove a widget instance from its sidebar and delete its stored settings by widget ID; no undo point is recorded.

Instructions

Remove a widget instance from its sidebar and delete its settings. The widget option is rewritten directly, without the widget's own cleanup routines. Returns deleted and id; an id found neither in a sidebar nor in the stored settings is reported as not found. Permanent: no undo point is recorded. The settings of an existing widget change with wp_update_widget.

Input Schema

NameRequiredDescriptionDefault
idYesWidget id "<id_base>-<number>" as wp_get_widgets lists it, e.g. "text-2".

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv4.10.0

TDQS

A4.5/5.0
Behavior5/5

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

Goes well beyond the annotations: it discloses that the widget option is rewritten directly, bypassing the widget's own cleanup routines — a side-effect an agent cannot infer from destructiveHint alone. It adds that no undo point is recorded (relevant given the wp_undo sibling), describes the return payload ('deleted and id'), and defines the not-found reporting behavior.

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?

Four tight sentences, front-loaded with the action and its scope, then side effects, return shape, permanence, and the sibling alternative. No sentence is redundant with the title or annotations.

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?

No output schema exists, and the description supplies the return shape and the not-found case; the mutation's irreversibility and cleanup bypass are stated. For a one-parameter destructive tool, an agent has everything needed to call it correctly and understand the consequences.

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 coverage is 100% and the schema already documents the id format with an example ('text-2'). The description adds no further parameter detail such as format validation or behavior for malformed ids, so it neither compensates for nor exceeds the schema baseline.

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+resource pair ('Remove a widget instance from its sidebar and delete its settings'), and immediately distinguishes the case from wp_update_widget, which handles changing settings of an existing widget. An agent can tell this apart from wp_add_widget and wp_update_widget without opening any schema.

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?

The closing sentence explicitly routes the adjacent-but-different case ('settings of an existing widget change with wp_update_widget'), giving clear selection guidance. It also defines the not-found condition. There is no explicit 'do not use for X' exclusion beyond that one sibling, but the context is unambiguous.

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