update-category
Modify an existing category's properties including description, label, help text, object panel position, and cascading filters in the PI Dashboard.
Instructions
Update an existing category
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Category ID | |
| description | No | Unique name of a category | |
| label | No | Alternative text for the category | |
| helpText | No | Help text to describe the category | |
| categoryObjectsPosition | No | Position of category objects panel | |
| cascadeFilters | No | Enable cascading filters |
Implementation Reference
- build/index.js:692-719 (handler)The asynchronous handler function that implements the core logic for the 'update-category' tool. It constructs a payload from the provided optional parameters and performs a PUT request to `/categories/${id}` using authenticatedRequest, returning success or error content.}, async ({ id, description, label, helpText, categoryObjectsPosition, cascadeFilters }) => { try { const payload = {}; if (description !== undefined) payload.description = description; 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/${id}`, "PUT", payload); return { content: [{ type: "text", text: `Category updated successfully:\n${JSON.stringify(result, null, 2)}` }] }; } catch (error) { return { isError: true, content: [{ type: "text", text: `Error updating category: ${getErrorMessage(error)}` }] }; } });
- build/index.js:686-691 (schema)Input schema for the 'update-category' tool defined using Zod validators. Specifies required 'id' and optional fields for updating category properties.id: z.number().describe("Category ID"), description: z.string().optional().describe("Unique name of a category"), 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:685-719 (registration)Registration of the 'update-category' tool using server.tool(), including the tool name, description, input schema, and inline handler function.server.tool("update-category", "Update an existing category", { id: z.number().describe("Category ID"), description: z.string().optional().describe("Unique name of a category"), 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") }, async ({ id, description, label, helpText, categoryObjectsPosition, cascadeFilters }) => { try { const payload = {}; if (description !== undefined) payload.description = description; 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/${id}`, "PUT", payload); return { content: [{ type: "text", text: `Category updated successfully:\n${JSON.stringify(result, null, 2)}` }] }; } catch (error) { return { isError: true, content: [{ type: "text", text: `Error updating category: ${getErrorMessage(error)}` }] }; } });