Skip to main content
Glama

update-category

Modify a WordPress category by updating its name, description, slug, parent ID, or meta fields using site URL, credentials, and category ID for precise adjustments.

Instructions

Update an existing WordPress category

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
categoryIdYesID of the category to update
descriptionNoNew HTML description of the term
metaNoNew meta fields
nameNoNew HTML title for the term
parentNoNew parent term ID
passwordYesWordPress application password
siteUrlYesWordPress site URL
slugNoNew alphanumeric identifier for the term
usernameYesWordPress username

Implementation Reference

  • The async handler function for the 'update-category' tool. It constructs update data from input parameters, validates that at least one field is provided, makes a POST request to the WordPress REST API /categories/{categoryId} endpoint using makeWPRequest, and returns success or error message.
    async ({ 
      siteUrl, 
      username, 
      password,
      categoryId,
      name,
      description,
      slug,
      parent,
      meta,
    }) => {
      try {
        const categoryData: Record<string, any> = {};
    
        if (name) categoryData.name = name;
        if (description) categoryData.description = description;
        if (slug) categoryData.slug = slug;
        if (parent) categoryData.parent = parent;
        if (meta) categoryData.meta = meta;
    
        if (Object.keys(categoryData).length === 0) {
          return {
            content: [
              {
                type: "text",
                text: "No update data provided. Please specify at least one field to update.",
              },
            ],
          };
        }
    
        const category = await makeWPRequest<WPCategory>({
          siteUrl,
          endpoint: `categories/${categoryId}`,
          method: "POST",
          auth: { username, password },
          data: categoryData
        });
        
        return {
          content: [
            {
              type: "text",
              text: `Successfully updated category:\nID: ${category.id}\nName: ${category.name || name || "Unchanged"}\nSlug: ${category.slug || slug || "Unchanged"}`,
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: `Error updating category: ${error instanceof Error ? error.message : String(error)}`,
            },
          ],
        };
      }
    }
  • Zod input schema defining parameters for the update-category tool: required siteUrl, username, password, categoryId; optional name, description, slug, parent, meta.
    {
      siteUrl: z.string().url().describe("WordPress site URL"),
      username: z.string().describe("WordPress username"),
      password: z.string().describe("WordPress application password"),
      categoryId: z.number().describe("ID of the category to update"),
      name: z.string().optional().describe("New HTML title for the term"),
      description: z.string().optional().describe("New HTML description of the term"),
      slug: z.string().optional().describe("New alphanumeric identifier for the term"),
      parent: z.number().optional().describe("New parent term ID"),
      meta: z.record(z.any()).optional().describe("New meta fields"),
    },
  • src/index.ts:1985-2057 (registration)
    The server.tool() call that registers the 'update-category' MCP tool with name, description, input schema, and inline handler function.
    server.tool(
      "update-category",
      "Update an existing WordPress category",
      {
        siteUrl: z.string().url().describe("WordPress site URL"),
        username: z.string().describe("WordPress username"),
        password: z.string().describe("WordPress application password"),
        categoryId: z.number().describe("ID of the category to update"),
        name: z.string().optional().describe("New HTML title for the term"),
        description: z.string().optional().describe("New HTML description of the term"),
        slug: z.string().optional().describe("New alphanumeric identifier for the term"),
        parent: z.number().optional().describe("New parent term ID"),
        meta: z.record(z.any()).optional().describe("New meta fields"),
      },
      async ({ 
        siteUrl, 
        username, 
        password,
        categoryId,
        name,
        description,
        slug,
        parent,
        meta,
      }) => {
        try {
          const categoryData: Record<string, any> = {};
    
          if (name) categoryData.name = name;
          if (description) categoryData.description = description;
          if (slug) categoryData.slug = slug;
          if (parent) categoryData.parent = parent;
          if (meta) categoryData.meta = meta;
    
          if (Object.keys(categoryData).length === 0) {
            return {
              content: [
                {
                  type: "text",
                  text: "No update data provided. Please specify at least one field to update.",
                },
              ],
            };
          }
    
          const category = await makeWPRequest<WPCategory>({
            siteUrl,
            endpoint: `categories/${categoryId}`,
            method: "POST",
            auth: { username, password },
            data: categoryData
          });
          
          return {
            content: [
              {
                type: "text",
                text: `Successfully updated category:\nID: ${category.id}\nName: ${category.name || name || "Unchanged"}\nSlug: ${category.slug || slug || "Unchanged"}`,
              },
            ],
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `Error updating category: ${error instanceof Error ? error.message : String(error)}`,
              },
            ],
          };
        }
      }
    );
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It states 'Update' which implies mutation, but doesn't describe what happens on success/failure, whether changes are reversible, permission requirements, or rate limits. For a mutation tool with 9 parameters and no annotation coverage, this is a significant gap in transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, clear sentence that states exactly what the tool does with zero wasted words. It's front-loaded with the core purpose and doesn't contain any unnecessary elaboration or repetition.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a mutation tool with 9 parameters, no annotations, and no output schema, the description is insufficiently complete. It doesn't address authentication requirements (though parameters suggest them), error conditions, return values, or how this tool differs behaviorally from similar update operations. The agent lacks critical context for proper tool invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so all parameters are documented in the schema. The description adds no additional parameter information beyond what's in the schema - it doesn't explain relationships between parameters, provide examples, or clarify edge cases. Baseline score of 3 is appropriate when the schema does all the parameter documentation work.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Update') and resource ('an existing WordPress category'), making the purpose immediately understandable. It distinguishes this from creation tools like 'create-category' by specifying 'existing', but doesn't explicitly differentiate from other update tools like 'update-post' or 'update-user' beyond the resource type.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites like authentication requirements, nor does it contrast with sibling tools like 'get-category' for reading or 'delete-category' for removal. The agent must infer usage from the tool name alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/prathammanocha/wordpress-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server