Create Category


Creates a new post category. Optionally set a parent category (to create a sub-category), a custom slug, and a description. Fails with a clear error if a category with the same name already exists.

Property Value
Ability slug mosmcp/category-create
Wire tool name mosmcp__category-create
Category Categories (mosmcp-categories)
Plan Free

 

Required access

Requirement Value
Capability manage_categories
Minimum default role Editor
Annotations readOnly: false · destructive: false · idempotent: false · openWorld: false

 

Input schema

Field Type Required Default Description
name string (min length 1) Yes — The name of the new category.
parent_id integer (min 1) — Optional ID of a parent category, to create this as a sub-category.
slug string (min length 1) — Optional custom URL slug. If omitted, WordPress generates one from the name.
description string — Optional description of the category.

 

Output schema

Field Type Required
id integer Yes
name string Yes
slug string
description string
parent_id integer
edit_url string

 

Example

Sample prompt
Add a new blog category called 'Recipes' under 'Food'.

Example request (json)

{
  "jsonrpc": "2.0",
  "id": 57,
  "method": "tools/call",
  "params": {
    "name": "mosmcp__category-create",
    "arguments": {
      "input": {
        "name": "Recipes",
        "parent_id": 5,
        "description": "Step-by-step recipes from our kitchen."
      }
    }
  }
}

Example response (json)

{
  "jsonrpc": "2.0",
  "id": 57,
  "result": {
    "isError": false,
    "structuredContent": {
      "id": 23,
      "name": "Recipes",
      "slug": "recipes",
      "description": "Step-by-step recipes from our kitchen.",
      "parent_id": 5,
      "edit_url": "https://example.com/wp-admin/term.php?taxonomy=category&tag_ID=23"
    }
  }
}

 

Edge cases / errors

  • A category with the same name already exists → refused with category_exists, naming the existing ID.
  • parent_id does not exist → refused with parent_not_found.
  • name empty after sanitizing → missing_name; a slug already used by another category → WordPress's own duplicate-term error.

 


<< Previous Next >>
Update Page Delete Category

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.