Skip to main content
Glama

wp_replace_section

Replace, insert, or delete ONE top-level section without rewriting the whole page — SAFER than wp_update_page for large pages (every other section is preserved exactly, so you can't accidentally drop content). Target the section by index (0-based, from wp_get_page outline) or top-level node_id. sections is the same native spec wp_update_page takes. op: replace (default) | insert_before | insert_after | delete | append. dry_run=true previews the section counts. Round-trip validated, write-gated.

Input Schema

NameRequiredDescriptionDefault
opNoreplace (default) | insert_before | insert_after | delete | append
indexNo0-based top-level section index (or use node_id)
atomicNoEditor V4 ATOMIC spec (JSON array) for sites where Editor V4 is active: [{type: heading|paragraph|image|button|div|flex|grid|tabs, …}]; tabs = {type:"tabs", tabs:[{label, children:[…]}], active:0}. XeoRank emits valid V4 JSON (e-tabs/e-tabs-menu/e-tab/e-tabs-content-area/e-tab-content, typed envelopes, ids). wp_widget_schema("e-tabs") and wp_section_recipes("v4-tabs") show the shape. Raw elements also accepted via elementor_data/elements.
dry_runNoPreview section counts without writing. Default false.
node_idNoA top-level element id from wp_get_page outline (or use index)
post_idYesThe page/post ID
site_idYesThe WordPress site ID
elementsNoRAW top-level element JSON, spliced in VERBATIM — use this for Editor V4 Atomic (e-flexbox, e-div-block, e-heading, ...). The `sections` spec below always emits the classic CONTAINER model and cannot express atomic at all, so appending atomic through it silently downgrades it. Verbatim also means you can assemble a large page one section at a time instead of resending the whole thing.
sectionsNoJSON array of native section objects (required unless op=delete)
allow_widget_lossNoop=replace on a `sections` spec: required (true) if the existing section has a widget type the spec builder cannot recreate (409 would_destroy_unsupported_widgets names them first, without this). Not needed for `elements` (verbatim) -- that path never runs this guard, since you are supplying the full replacement yourself.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.7/5.0
Behavior5/5

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

Annotations only give the coarse safety flags (readOnlyHint=false, destructiveHint=false, idempotentHint=false, openWorldHint=true); the description adds substantial behavior beyond them — other sections are preserved exactly, verbatim splicing semantics for elements, the 409 would_destroy_unsupported_widgets guard and the allow_widget_loss bypass, 'round-trip validated, write-gated', and what dry_run actually previews. This is well past the lower bar set by annotations.

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-loaded with the action and the safety rationale before any parameter talk, and every sentence carries new information (op list, targeting, preview, guards). It is dense and dash-heavy for a 10-parameter tool, so it is at the upper end of reasonable rather than spare.

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 10-parameter, write-gated mutation tool with no output schema, the description covers targeting, op semantics, the destructive-widget guard, escaping hatches, and preview behavior. It never describes what a successful (non-dry-run) call returns, which is the one remaining gap given there is no output schema to lean on.

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 description coverage is already 100%, so the baseline is 3; the description still adds meaning the schema does not, notably that index is 0-based and sourced from the wp_get_page outline, that sections is the same native spec wp_update_page takes, and the semantic distinction between verbatim elements and the container-model sections spec. It does not explain the append op's interaction with index/node_id, which keeps it below a 5.

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 precise verb set (replace/insert/delete) on a precise resource (ONE top-level section) and immediately scopes it against the whole-page alternative wp_update_page. An agent can tell this apart from wp_update_page, wp_patch_page, and wp_bulk_replace 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 an explicit selection rule ('SAFER than wp_update_page for large pages'), names the context in which it applies (target by index from wp_get_page outline or node_id), and includes a when-not caveat ('sections ... cannot express atomic at all') with the correct alternative path (elements). dry_run is framed as the preview step. This is routing-level guidance, not just context.

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