Update Theme Template
Replaces a block theme template's markup, staged in the theme draft — nothing changes for visitors until the draft is published. Works whether the template is still the theme's file or was already customised in the Site Editor. For a small wording change, mosmcp/theme-text-replace is safer than rewriting the whole template.
| Property | Value |
|---|---|
| Ability slug | mosmcp/theme-template-update |
| Wire tool name | mosmcp__theme-template-update |
| Category | Theme: Templates and Styles (mosmcp-theme-blocks) |
| Plan | Free |
Required access
| Requirement | Value |
|---|---|
| Capability | edit_theme_options |
| Minimum default role | Administrator (Shop manager too when WooCommerce is active) |
| Annotations | readOnly: false · destructive: false · idempotent: true · openWorld: false |
Input schema
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| slug | string | Yes | — | Template slug, for example "single" or "home". |
| content | string | Yes | — | The complete new block markup. |
Output schema
| Field | Type | Required | Description |
|---|---|---|---|
| staged | boolean | Yes | |
| target | string | ||
| change | string | ||
| draft | object | Yes | |
| draft.exists | boolean | ||
| draft.change_count | integer | ||
| draft.templates | string[] | ||
| draft.template_parts | string[] | ||
| draft.global_styles | string | ||
| draft.patterns | string[] | ||
| draft.files | string[] | ||
| draft.site_identity | string[] | Pending logo and site icon changes. | |
| draft.custom_css | string[] | Pending change to the Customizer's Additional CSS. A block theme's Additional CSS is part of global styles. | |
| draft.theme_settings | string[] | Pending theme (Customizer) settings. | |
| draft.created | string | ||
| draft.updated | string | ||
| draft.preview_ready | boolean | ||
| next_step | string | ||
| notes | string[] |
Example
Sample prompt
Change my single post template so the featured image appears above the title.
Example request (json)
{
"jsonrpc": "2.0",
"id": 299,
"method": "tools/call",
"params": {
"name": "mosmcp__theme-template-update",
"arguments": {
"input": {
"slug": "single",
"content": "<!-- wp:template-part {\"slug\":\"header\"} /-->
<!-- wp:post-featured-image /-->
<!-- wp:post-title /-->
<!-- wp:post-content /-->"
}
}
}
}Example response (json)
{
"jsonrpc": "2.0",
"id": 299,
"result": {
"isError": false,
"structuredContent": {
"staged": true,
"target": "the template \"single\"",
"change": "content updated",
"draft": {
"exists": true,
"change_count": 1,
"templates": [
"single (update)"
],
"template_parts": [],
"global_styles": "",
"patterns": [],
"files": [],
"created": "2026-09-29 10:12:04",
"updated": "2026-09-29 10:14:37",
"preview_ready": true
},
"next_step": "Nothing has changed on the live site yet. Preview the draft with mosmcp/theme-draft-preview, then publish it with mosmcp/theme-draft-publish.",
"notes": []
}
}
}
Edge cases / errors
- Empty content -> refused with mosmcp_block_markup_empty (a blank template renders a blank page; use the reset ability instead).
- Unbalanced <!-- wp:... --> / <!-- /wp:... --> comments -> refused with mosmcp_block_markup_broken; nothing staged.
- content identical to the current (draft or live) markup -> refused with mosmcp_no_change.
- Unknown slug -> mosmcp_template_not_found; classic theme -> mosmcp_not_a_block_theme. Nothing goes live until the draft is published.
| << Previous | Next >> |
|---|---|
| Update Global Styles | Update Theme Template Part |
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.