Skip to main content
Glama

wp_patch_page

Surgically edit an Elementor page by element id — send ONLY the elements you're changing. Far cheaper than wp_update_page, which rewrites the WHOLE page. Preserves layout/ids; round-trip validated; write-gated. dry_run=true previews a real before/after diff without writing.

Two kinds of op: CONTENT: {node_id, field, new_value} — field comes from wp_get_page nodes. new_value may be a string OR an object, e.g. {"unit":"px","size":18}. STYLE: {node_id, style:{color, bg, radius, padding, margin, border, shadow, align}} — Xyle translates these into the widget's real Elementor keys, so you never guess. Call wp_style_keys(widget_type) first to see what a widget supports. Works on SECTION/CONTAINER nodes too (node_id of a container from wp_get_page outline): style:{bg, padding, radius, shadow} colors/pads the band with native container keys.

EFFECT CHECK: after applying, the response re-reads the stored page and marks each change effective:true/false (with effective_count / ineffective_count). Read those, not just applied:true — effective:false means the write persisted but the widget ignored that key; the stored value shows what actually landed. Fix by calling wp_widget_controls for the element's real key, then re-patch. (Verifies stored data, not final render — confirm visuals with render_screenshot.)

GUTENBERG / BLOCK pages (wp_get_page builder != elementor, ids like b0, b1.2): ops are {node_id, field:'attrs.<dotted.key>', new_value} to set one block attribute (e.g. attrs.data.headline on an ACF block, attrs.level on a heading; null deletes it) or {node_id, field:'html', new_value} to replace a block's inner markup. style ops are Elementor-only and are refused there. A parent's attrs and a child's html can change in one call; an html op on a parent plus any edit to its child is refused as a conflict.

Use wp_update_page only for full redesigns / adding new sections.

Input Schema

NameRequiredDescriptionDefault
opsYesJSON array: [{node_id, field, new_value}] and/or [{node_id, style:{...}}]. Editor V4 atomic elements: use the prop name (title, paragraph, text, tag, link, image) with a bare value — XeoRank envelopes it ({$$type, value}); text/content aliases resolve. TABS: {node_id: <e-tabs id>, tabs: {labels: [...], active: 0, order: [...]}} relabels, adds, removes and reorders tabs keeping each panel's content. Every patch also types V4 text the Elementor editor showed blank; ops=[] does only that.
dry_runNoPreview the diff without writing (propose). Default false.
post_idYesThe page/post ID
site_idYesThe WordPress site ID

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.9/5.0
Behavior5/5

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

Goes well beyond the annotations: write-gated execution, dry_run before/after diff, and a detailed EFFECT CHECK contract explaining that applied:true is insufficient and effective:false means the widget ignored the key with the stored value showing what landed. It also discloses the verification boundary ('verifies stored data, not final render') and points to render_screenshot. This is exactly the behavioral context annotations cannot convey.

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?

Long, but structurally disciplined — lead pitch first, then per-op-type sections, then the effect-check caveat, then the sibling fallback. Dense compound sentences pack multiple facts; a few parentheticals are tightly compressed, but for a multi-builder patch tool almost every line carries operational weight.

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?

There is no output schema, so the description must describe return behavior — and it does, explaining the effective:true/false flags, effective_count/ineffective_count, and the stored value, plus the note that ops=[] performs a V4 text type-repair pass. Nothing an agent needs to call this correctly is missing.

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

Parameters5/5

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

Schema coverage is already 100%, but the description adds substantial meaning: it enumerates the two op shapes (CONTENT {node_id, field, new_value}, STYLE {node_id, style:{...}}), the valid field vocabulary, object new_value forms like {"unit":"px","size":18}, the Gutenberg 'attrs.<dotted.key>' convention with null-delete semantics, and the tabs relabel/order form. Far above the baseline 3 for full-coverage schemas.

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 — 'surgically edit an Elementor page by element id' — and explicitly contrasts itself with wp_update_page ('which rewrites the WHOLE page'). An agent can distinguish this from the many wp_* siblings 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 Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives explicit when-to-use: send only the elements you're changing, use dry_run to preview, call wp_style_keys first for widget support. It also names the alternative and its condition ('Use wp_update_page only for full redesigns / adding new sections') and lists refusal conditions (style ops on Gutenberg, html op on a parent plus child edit).

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