create-category
Create a new category in the PI API MCP Server by specifying unique details such as description, organization ID, label, and help text. Manage category object positions and enable cascading filters for efficient organization.
Instructions
Create a new category
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cascadeFilters | No | Enable cascading filters | |
| categoryObjectsPosition | No | Position of category objects panel | |
| description | Yes | Unique name of a category | |
| helpText | No | Help text to describe the category | |
| label | No | Alternative text for the category | |
| orgId | Yes | Organization ID |
Implementation Reference
- build/index.js:655-683 (handler)The core handler function implementing the 'create-category' tool logic. It builds a payload from validated inputs and performs an authenticated POST request to the '/categories' API endpoint, returning success or error content.}, async ({ description, orgId, label, helpText, categoryObjectsPosition, cascadeFilters }) => { try { const payload = { description, orgId }; if (label !== undefined) payload.label = label; if (helpText !== undefined) payload.helpText = helpText; if (categoryObjectsPosition !== undefined) payload.categoryObjectsPosition = categoryObjectsPosition; if (cascadeFilters !== undefined) payload.cascadeFilters = cascadeFilters; const result = await authenticatedRequest("/categories", "POST", payload); return { content: [{ type: "text", text: `Category created successfully:\n${JSON.stringify(result, null, 2)}` }] }; } catch (error) { return { isError: true, content: [{ type: "text", text: `Error creating category: ${getErrorMessage(error)}` }] }; } });
- build/index.js:649-654 (schema)Zod input schema defining parameters for the 'create-category' tool, including required fields (description, orgId) and optional fields (label, helpText, categoryObjectsPosition, cascadeFilters).description: z.string().describe("Unique name of a category"), orgId: z.number().describe("Organization ID"), label: z.string().optional().describe("Alternative text for the category"), helpText: z.string().optional().describe("Help text to describe the category"), categoryObjectsPosition: z.enum(["RIGHT", "TOP"]).optional().describe("Position of category objects panel"), cascadeFilters: z.boolean().optional().describe("Enable cascading filters")
- build/index.js:648-648 (registration)The server.tool registration call for the 'create-category' tool, specifying its name, description, input schema, and handler function.server.tool("create-category", "Create a new category", {