Set Post Template


Assigns a page template to a post, for example one of Elementor's full-width or canvas templates. Only templates the active theme and its plugins actually register are accepted, so a mistyped slug is refused instead of silently falling back to the default.

Property Value
Ability slug mosmcp/post-template-set
Wire tool name mosmcp__post-template-set
Category Posts (mosmcp-posts)
Plan Free

 

Required access

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

 

Input schema

Field Type Required Default Description
id integer (min 1) Yes — The ID of the post to update.
page_template string (min length 1) Yes — Template slug to assign, or "default" for the theme default. Read the post first to list the slugs available on this site.

 

Output schema

Field Type Required Description
id integer Yes
previous string Yes Template slug before the change.
current string Yes Template slug after the change.
label string
changed boolean Yes
view_url string
warnings object[] Non-fatal issues encountered while running.
warnings[].code string
warnings[].message string
warnings[].context string

 

Example

Sample prompt
Switch post 42 to the Elementor Full Width template.

Example request (json)

{
  "jsonrpc": "2.0",
  "id": 25,
  "method": "tools/call",
  "params": {
    "name": "mosmcp__post-template-set",
    "arguments": {
      "input": {
        "id": 42,
        "page_template": "elementor_header_footer"
      }
    }
  }
}

Example response (json)

{
  "jsonrpc": "2.0",
  "id": 25,
  "result": {
    "isError": false,
    "structuredContent": {
      "id": 42,
      "previous": "default",
      "current": "elementor_header_footer",
      "label": "Elementor Full Width",
      "changed": true,
      "view_url": "https://example.com/autumn-sale/",
      "warnings": []
    }
  }
}

 

Edge cases / errors

  • A slug the active theme and plugins do not register → refused with unknown_page_template, listing the valid slugs.
  • page_template of default → the template assignment is removed so the theme default applies.
  • The value reads back differently after saving (usually a plugin filtering it) → a template_not_stored warning.
  • id that is not a post → post_not_found.

 


<< Previous Next >>
Set Post Featured Image Set Post to Pending Review

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.