Insert Blocks


Adds new blocks to a post or page: at the start or end, before or after a block, or inside a container such as a group, column, list or buttons. Give simple blocks in "blocks" (paragraph, heading, list, quote, button, image from the media library, separator, spacer, custom HTML) and they are built exactly as the editor builds them; give any other block as "markup"; or insert a registered "pattern" or a synced pattern by ID. Checked before saving: block types must exist, blocks must be allowed where they go (a list item only in a list, a column only in columns), and HTML follows the editor's rule.

Also known as: add a section, add paragraph, add heading, add image to page, insert pattern, add a button, add content to page.

Property Value
Ability slug mosmcp/block-insert
Wire tool name mosmcp__block-insert
Category Block Editor (mosmcp-blocks)
Plan Free

 

Required access

Requirement Value
Capability edit_post (checked against the specific post)
Minimum default role Contributor
Annotations readOnly: false · destructive: false · idempotent: false · openWorld: false

 

Input schema

Field Type Required Default Description
id integer (min 1) Yes — ID of the post, page, custom post item or synced pattern.
blocks object[] — Simple blocks to build, in order. Use this, "markup", "pattern" or "synced_pattern_id": exactly one.
blocks[].type string (one of paragraph, heading, list, quote, button, image, separator, spacer, html) Yes — Block to build.
blocks[].text string — Text for paragraph, heading, quote and button; raw HTML for html. Inline formatting allowed.
blocks[].level integer (1–6) — Heading level, 1 to 6.
blocks[].items string[] — List items.
blocks[].ordered boolean — Numbered list instead of bullets.
blocks[].citation string — Quote attribution.
blocks[].url string — Button link.
blocks[].attachment_id integer — Image: media library ID (upload first with mosmcp/media-upload-from-url).
blocks[].alt string — Image alt text; defaults to the media item's own.
blocks[].size string — Image size such as "large", "medium" or "full".
blocks[].height integer — Spacer height in pixels.
markup string — Block markup for any block, in the format WordPress stores. HTML is saved the way the WordPress editor saves it: a user with the unfiltered_html capability can save any markup, including forms, scripts and styles, and markup a user is not allowed to save is refused with the reason rather than silently removed. Backslashes are kept.
pattern string — Name of a registered pattern to insert, such as "twentytwentyfive/cta-newsletter". List them with mosmcp/theme-pattern-list.
synced_pattern_id integer — ID of a synced pattern (reusable block) to insert as a reference, so later edits to the pattern show here too.
position string (one of start, end, before, after, inside_start, inside_end) end Where to put it: "start" or "end" of the content, "before" or "after" the target block, or "inside_start" or "inside_end" of the target container.
target string — Path of the block the position is relative to. Required for before, after, inside_start and inside_end.
expected_modified string — The "modified" value from your last read. When given, the change is refused if the content has changed since, so a stale path can never hit the wrong block.

 

Output schema

Field Type Required Description
id integer Yes
post_type string
title string
status string
modified string Yes Last-modified time. Pass it as expected_modified on your next change.
view_url string Public address, when published.
preview_url string Preview address for unpublished content, for signed-in editors.
edit_url string
path string Yes Path of the first inserted block.
block string
paths string[] Yes Paths of every inserted block.
changed boolean Yes False when the content already matched and nothing was saved.
revision_id integer Revision holding the previous version, for mosmcp/revision-restore; 0 when none was made.
warnings object[] Non-fatal issues encountered while running.
warnings[].code string
warnings[].message string
warnings[].context string
notes string[]

 


<< Previous Next >>
Get Block List Block Types

For more information about the Secure MCP Server for WordPress plugin, explore the following resources:

Product Overview | Pricing | Try for Free | Documentation

If you have any questions regarding plugin configuration, pricing plans or licensing, please contact us or mail us at aisupport@xecurify.com.