Skip to main content
Glama

wp_get_category

Retrieve a specific WordPress category by its unique ID to access category details and structure for site management and content organization.

Instructions

Retrieves a single category by its ID.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
siteNoThe ID of the WordPress site to target (from mcp-wordpress.config.json). Required if multiple sites are configured.
idYesThe unique identifier for the category.

Implementation Reference

  • The handler function that executes the wp_get_category tool. It fetches the category by ID from the WordPress client and returns a formatted details string.
    public async handleGetCategory(client: WordPressClient, params: Record<string, unknown>): Promise<unknown> {
      const { id } = params as { id: number };
      try {
        const category = await client.getCategory(id);
        const content =
          `**Category Details (ID: ${category.id})**\n\n` +
          `- **Name:** ${category.name}\n` +
          `- **Slug:** ${category.slug}\n` +
          `- **Description:** ${category.description || "None"}\n` +
          `- **Post Count:** ${category.count}`;
        return content;
      } catch (_error) {
        throw new Error(`Failed to get category: ${getErrorMessage(_error)}`);
      }
    }
  • Registers the wp_get_category tool in TaxonomyTools.getTools(), including schema (parameters), description, and handler binding.
    {
      name: "wp_get_category",
      description: "Retrieves a single category by its ID.",
      parameters: [
        {
          name: "id",
          type: "number",
          required: true,
          description: "The unique identifier for the category.",
        },
      ],
      handler: this.handleGetCategory.bind(this),
    },
Behavior2/5

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

With no annotations provided, the description carries full burden but only states the basic operation. It doesn't disclose behavioral aspects like authentication requirements, error handling, rate limits, or what happens if the ID doesn't exist. For a read operation with zero annotation coverage, this is insufficient.

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 with no wasted words. It's front-loaded with the core purpose and appropriately sized for a simple retrieval tool.

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

Completeness3/5

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

For a simple read operation with good schema coverage but no annotations or output schema, the description is minimally adequate. It states what the tool does but lacks important context about authentication, error cases, and relationship to sibling tools that would make it more complete.

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 the schema already documents both parameters thoroughly. The description doesn't add any parameter semantics beyond what's in the schema, which is acceptable given the comprehensive schema documentation.

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 ('retrieves') and resource ('a single category'), making the purpose immediately understandable. However, it doesn't explicitly differentiate this from sibling tools like 'wp_list_categories' or 'wp_get_post', which would require a 5.

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?

No guidance is provided on when to use this tool versus alternatives like 'wp_list_categories' for multiple categories or other 'wp_get_*' tools for different resources. The description only states what it does, not when it's appropriate.

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

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/docdyhr/mcp-wordpress'

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