Create Custom Content Item
Creates a new item of a custom content type, as a draft unless another status is given. Fields the type does not support are refused rather than stored where nothing would ever show them. Set the item's custom fields and taxonomy terms afterwards, or duplicate an existing item to inherit its design.
| Property | Value |
|---|---|
| Ability slug | mosmcp/cpt-create |
| Wire tool name | mosmcp__cpt-create |
| Category | Custom Content (mosmcp-cpt) |
| Plan | Free |
Required access
| Requirement | Value |
|---|---|
| Capability | edit_posts |
| Minimum default role | Contributor |
| Annotations | readOnly: false · destructive: false · idempotent: false · openWorld: false |
Input schema
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| post_type | string (min length 1) | Yes | — | Which custom content type to work with, as reported by the list-types ability — for example "service" or "team_member". |
| title | string (min length 1) | Yes | — | Title for the new item. |
| content | string | — | Body text. Only for types that support an editor. 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. On sites that use the block editor, write it as block markup, the format the editor saves (for example <!-- wp:heading --><h2 class="wp-block-heading">Title</h2><!-- /wp:heading --> then <!-- wp:paragraph --><p>Text</p><!-- /wp:paragraph -->), so each heading, paragraph or button can be edited on its own later. Plain HTML is saved as one "Classic" block. For a new page it is often simplest to create it with a title only and add the content with mosmcp/block-insert, which builds the blocks for you. | |
| excerpt | string | — | Excerpt. Only for types that support one. | |
| status | string (one of draft, pending, private, publish) |
draft |
Status for the new item. Publishing requires the type's publish capability. | |
| parent_id | integer (min 1) | — | Parent item, for hierarchical types. | |
| slug | string | — | New URL slug. Omit to leave the address unchanged. Reduced to a URL-safe form, and a suffix is added if it is already taken. | |
| meta | object | — | Custom fields to set on the new item, as field name => value. Use the exact field names from the describe-type ability. Values are converted to the format each field is stored in, so a date field that holds a Unix timestamp accepts a readable date. A field that cannot be written does not fail the call: it is reported in warnings, and fields_set lists the ones that were stored. |
Output schema
| Field | Type | Required | Description |
|---|---|---|---|
| id | integer | Yes | |
| post_type | string | Yes | |
| title | string | Yes | |
| slug | string | The URL slug as stored. | |
| status | string | Yes | |
| edit_url | string | ||
| view_url | string | ||
| fields_set | string[] | The custom fields that were stored. A field passed in meta but missing from this list was refused, and the reason is in warnings. | |
| warnings | object[] | Non-fatal issues encountered while running. | |
| warnings[].code | string | ||
| warnings[].message | string | ||
| warnings[].context | string |
Example
Sample prompt
Add a new service called 'Brand Audit' priced at 300, as a draft.
Example request (json)
{
"jsonrpc": "2.0",
"id": 133,
"method": "tools/call",
"params": {
"name": "mosmcp__cpt-create",
"arguments": {
"input": {
"post_type": "service",
"title": "Brand Audit",
"content": "<p>A review of your brand across every channel.</p>",
"meta": {
"price": 300
}
}
}
}
}Example response (json)
{
"jsonrpc": "2.0",
"id": 133,
"result": {
"isError": false,
"structuredContent": {
"id": 57,
"post_type": "service",
"title": "Brand Audit",
"slug": "brand-audit",
"status": "draft",
"edit_url": "https://example.com/wp-admin/post.php?post=57&action=edit",
"view_url": "https://example.com/?post_type=service&p=57",
"fields_set": [
"price"
],
"warnings": []
}
}
}
Edge cases / errors
- No status → created as a draft. publish or private without the type's publish capability → cannot_publish; missing the type's create capability → cannot_create.
- content or excerpt on a type that doesn't support an editor/excerpt → field_not_supported, nothing created.
- A meta field that can't be written (ACF-managed, protected, wrong value type) does not fail the call: the item is created, the field is left out of fields_set and a field_not_set warning gives the reason.
- Requested slug already taken → WordPress adds a suffix and a slug_adjusted_for_uniqueness warning reports the stored value; parent_id not an existing item of the same type → invalid_parent.
| << Previous | Next >> |
|---|---|
| Assign Terms To Custom Content | Delete Custom Field |
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.