wpnav_get_category
Retrieve detailed WordPress category information by ID, including description and post count, for content management and organization.
Instructions
Get a single WordPress category by ID. Returns full category details including description and post count.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | WordPress category ID |
Implementation Reference
- src/tools/taxonomy/index.ts:60-69 (handler)The handler function validates the category ID input, fetches the category details from the WordPress REST API endpoint `/wp/v2/categories/{id}`, and returns the JSON response as text content.handler: async (args, context) => { validateRequired(args, ['id']); const id = validateId(args.id, 'Category'); const category = await context.wpRequest(`/wp/v2/categories/${id}`); return { content: [{ type: 'text', text: context.clampText(JSON.stringify(category, null, 2)) }], }; },
- src/tools/taxonomy/index.ts:48-71 (registration)The tool registration within registerTaxonomyTools() function, including name, description, input schema requiring 'id' (number), handler, and ToolCategory.TAXONOMY.toolRegistry.register({ definition: { name: 'wpnav_get_category', description: 'Get a single WordPress category by ID. Returns full category details including description and post count.', inputSchema: { type: 'object', properties: { id: { type: 'number', description: 'WordPress category ID' }, }, required: ['id'], }, }, handler: async (args, context) => { validateRequired(args, ['id']); const id = validateId(args.id, 'Category'); const category = await context.wpRequest(`/wp/v2/categories/${id}`); return { content: [{ type: 'text', text: context.clampText(JSON.stringify(category, null, 2)) }], }; }, category: ToolCategory.TAXONOMY, });
- src/tools.ts:496-509 (schema)Static tool schema definition listed in the exported tools array for client discovery or documentation purposes.{ name: 'wpnav_get_category', description: 'Get a single WordPress category by ID. Returns full category details including description and post count.', inputSchema: { type: 'object' as const, properties: { id: { type: 'number' as const, description: 'WordPress category ID', }, }, required: ['id'], },