Skip to main content
Glama

Add a widget

wp_add_widget
Destructive

Add a new widget of a registered type to a sidebar, or to wp_inactive_widgets. Returns added, id (the new "<id_base>-") and sidebar. Settings pass the widget's own update() sanitisation and the widget_update_callback filter, the same as the widgets screen — so HTML is filtered unless the account may post unfiltered HTML. An unknown type or sidebar, or settings the widget rejects, are refused and nothing is saved. Existing widgets are changed by wp_update_widget; no undo point is recorded. Forwarded by AlphaBridge Connect to the one site this connection reaches.

Input Schema

NameRequiredDescriptionDefault
id_baseYesWidget type base, e.g. "text", "nav_menu", "block", "search". Must be a registered type; the refusal lists the available ones.
sidebarYesTarget sidebar id as wp_list_sidebars lists it, e.g. "sidebar-1", or "wp_inactive_widgets".
positionNoOptional 0-based insert position within the sidebar; appended by default. Negative values count as 0.
settingsNoInitial settings for the new instance: text, numbers, true, false, null or flat lists. Optional; omitted means no settings.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changed
    • changedInput schema / properties / id_base / description
      Previous value: -"Widget type base, e.g. \"text\", \"nav_menu\", \"block\", \"search\"."New value: +"Widget type base, e.g. \"text\", \"nav_menu\", \"block\", \"search\". Must be a registered type; the refusal lists the available ones."
    • changedInput schema / properties / position / description
      Previous value: -"Optional 0-based insert position; appended by default."New value: +"Optional 0-based insert position within the sidebar; appended by default. Negative values count as 0."
    • changedInput schema / properties / settings / description
      Previous value: -"Initial settings for the new instance."New value: +"Initial settings for the new instance: text, numbers, true, false, null or flat lists. Optional; omitted means no settings."
    • changedInput schema / properties / sidebar / description
      Previous value: -"Target sidebar id."New value: +"Target sidebar id as wp_list_sidebars lists it, e.g. \"sidebar-1\", or \"wp_inactive_widgets\"."
  2. Added

TDQS

A4.6/5.0
Behavior5/5

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

Goes well beyond the annotations: it explains that settings pass the widget's own update() sanitisation and widget_update_callback filter, that HTML is filtered unless the account may post unfiltered HTML, that invalid input saves nothing, and that no undo point is recorded. The connection-scope note ('forwarded to the one site this connection reaches') also clarifies reach against openWorldHint.

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-loads the action and target, then moves to return shape, then behaviour, then the alternative tool and the undo caveat. Dense but every sentence carries information; the parenthetical id format and the AlphaBridge forwarding note are the only slightly incidental pieces.

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, yet the description enumerates the returned fields (added, id, sidebar). With all four parameters documented at 100% coverage and the mutation risks (sanitisation, refusal, no undo) disclosed, an agent has everything needed to call it correctly.

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 adds real meaning on top by specifying the returned id format ('<id_base>-<number>') and describing how the settings value is treated (sanitised through the widget's own update()), which the schema alone does not convey.

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 ('Add a new widget of a registered type') plus the two scopes it can target (a sidebar or wp_inactive_widgets), and explicitly contrasts itself with wp_update_widget, so an agent can distinguish it from the sibling mutation tool without opening either 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?

Explicitly routes modifications to wp_update_widget and notes the refusal conditions for unknown types/sidebars, giving clear usage context. It stops short of a full when-not statement (e.g. bulk operations or checking existing widgets first via wp_get_widgets), so it is strong but not exhaustive.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources