update_category
Update category details by providing its ID and optionally modifying name, slug, description, publication status, or parent assignment.
Instructions
Update a category.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | ID of the categorie to update | |
| name | No | Title of the category. | |
| slug | No | Friendly identifier of a category. | |
| description | No | The description of the category. | |
| is_published | No | Boolean if the category is published on the website. | |
| parent_id | No | Unique identifier of the parent category |
Implementation Reference
- src/tools/categories.ts:81-104 (registration)The tool 'update_category' is registered via server.registerTool() with its metadata (description, annotations, inputSchema) and handler.
server.registerTool( "update_category", { description: "Update a category.", annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true }, inputSchema: { id: z.number().int().positive().describe("ID of the categorie to update"), name: z.string().optional().describe("Title of the category."), slug: z.string().optional().describe("Friendly identifier of a category."), description: z.string().optional().describe("The description of the category."), is_published: z.boolean().optional().describe("Boolean if the category is published on the website."), parent_id: z.number().int().optional().describe("Unique identifier of the parent category"), }, }, async ({ id, ...body }) => { try { const record = await apiPatch<EduframeRecord>(`/categories/${id}`, body); void logResponse("update_category", { id, ...body }, record); return formatUpdate(record, "categorie"); } catch (error) { return formatError(error); } }, ); - src/tools/categories.ts:95-103 (handler)The async handler function for 'update_category': destructures id from body, calls apiPatch to PATCH /categories/{id}, logs the response, and formats the result.
async ({ id, ...body }) => { try { const record = await apiPatch<EduframeRecord>(`/categories/${id}`, body); void logResponse("update_category", { id, ...body }, record); return formatUpdate(record, "categorie"); } catch (error) { return formatError(error); } }, - src/tools/categories.ts:86-93 (schema)Input schema for 'update_category' using Zod: id (required number), name, slug, description, is_published, parent_id (all optional).
inputSchema: { id: z.number().int().positive().describe("ID of the categorie to update"), name: z.string().optional().describe("Title of the category."), slug: z.string().optional().describe("Friendly identifier of a category."), description: z.string().optional().describe("The description of the category."), is_published: z.boolean().optional().describe("Boolean if the category is published on the website."), parent_id: z.number().int().optional().describe("Unique identifier of the parent category"), }, - src/tools/index.ts:8-8 (registration)Import of registerCategorieTools (which registers update_category) in the central tools index.
import { registerCategorieTools } from "./categories"; - src/tools/index.ts:71-71 (registration)registerCategorieTools added to the tools array, called by registerAllTools() to register all category tools including update_category.
registerCategorieTools,