update_catalog_product
Update a catalog product by providing its ID and optional fields like category, publication status, custom properties, or course tab contents.
Instructions
Update a catalog product
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | ID of the catalog product to update | |
| category_id | No | Identifier of the category of the course. | |
| is_published | No | Boolean showing if the product is published or not. | |
| custom | No | The custom properties of the product. | |
| course_tab_contents_attributes | No |
Implementation Reference
- src/tools/catalog_products.ts:76-106 (handler)The handler function registered for the 'update_catalog_product' tool. It destructures `id` from the body, calls `apiPatch` on `/catalog/products/{id}`, logs the response, and returns a formatted update result.
server.registerTool( "update_catalog_product", { description: "Update a catalog product", annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true }, inputSchema: { id: z.number().int().positive().describe("ID of the catalog product to update"), category_id: z.number().int().optional().describe("Identifier of the category of the course."), is_published: z.boolean().optional().describe("Boolean showing if the product is published or not."), custom: z.object({}).optional().describe("The custom properties of the product."), course_tab_contents_attributes: z .array( z.object({ id: z.number().int().describe("Unique identifier of the course tab content."), content: z.string().describe("The HTML content of the course tab."), course_tab_id: z.number().int().describe("Unique identifier of the course tab."), }), ) .optional(), }, }, async ({ id, ...body }) => { try { const record = await apiPatch<EduframeRecord>(`/catalog/products/${id}`, body); void logResponse("update_catalog_product", { id, ...body }, record); return formatUpdate(record, "catalog product"); } catch (error) { return formatError(error); } }, ); - src/tools/catalog_products.ts:81-95 (schema)Input schema validation using Zod. Defines `id` (required, positive integer), and optional fields: `category_id`, `is_published`, `custom`, and `course_tab_contents_attributes` (array of objects with id, content, course_tab_id).
inputSchema: { id: z.number().int().positive().describe("ID of the catalog product to update"), category_id: z.number().int().optional().describe("Identifier of the category of the course."), is_published: z.boolean().optional().describe("Boolean showing if the product is published or not."), custom: z.object({}).optional().describe("The custom properties of the product."), course_tab_contents_attributes: z .array( z.object({ id: z.number().int().describe("Unique identifier of the course tab content."), content: z.string().describe("The HTML content of the course tab."), course_tab_id: z.number().int().describe("Unique identifier of the course tab."), }), ) .optional(), }, - src/tools/index.ts:69-69 (registration)The registration function `registerCatalogProductTools` is included in the `tools` array, which is iterated over to register all tools with the MCP server.
registerCatalogProductTools, - src/tools/index.ts:6-6 (registration)Import of the `registerCatalogProductTools` function from the `catalog_products` module.
import { registerCatalogProductTools } from "./catalog_products"; - src/api.ts:201-212 (helper)The `apiPatch` helper function used by the handler to make the PATCH request to `/catalog/products/{id}`.
export async function apiPatch<T>(path: string, body: unknown): Promise<T> { const { token } = getConfig(); const url = buildUrl(path); const response = await fetch(url.toString(), { method: "PATCH", headers: buildHeaders(token), body: JSON.stringify(body), }); return handleResponse<T>(response); }