update_program_element
Update a program element by its ID, with optional assignment to a course edition or planned course.
Instructions
Update an element
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | ID of the program element to update | |
| edition_id | No | The identifier of the associated course. | |
| planned_course_id | No | The identifier of the associated course. |
Implementation Reference
- src/tools/program_elements.ts:93-101 (handler)The async handler function that executes the update_program_element tool logic. It extracts the `id` from input, PATCHes the remaining body to `/program/elements/${id}`, logs the response, and returns formatted output.
async ({ id, ...body }) => { try { const record = await apiPatch<EduframeRecord>(`/program/elements/${id}`, body); void logResponse("update_program_element", { id, ...body }, record); return formatUpdate(record, "program element"); } catch (error) { return formatError(error); } }, - src/tools/program_elements.ts:87-91 (schema)Input schema defined with Zod, requiring an `id` (positive int), and optional `edition_id` and `planned_course_id` (both ints).
inputSchema: { id: z.number().int().positive().describe("ID of the program element to update"), edition_id: z.number().int().optional().describe("The identifier of the associated course."), planned_course_id: z.number().int().optional().describe("The identifier of the associated course."), }, - src/tools/program_elements.ts:82-102 (registration)The full tool registration via server.registerTool, binding the name 'update_program_element' with its description, annotations, input schema, and handler function.
server.registerTool( "update_program_element", { description: "Update an element", annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true }, inputSchema: { id: z.number().int().positive().describe("ID of the program element to update"), edition_id: z.number().int().optional().describe("The identifier of the associated course."), planned_course_id: z.number().int().optional().describe("The identifier of the associated course."), }, }, async ({ id, ...body }) => { try { const record = await apiPatch<EduframeRecord>(`/program/elements/${id}`, body); void logResponse("update_program_element", { id, ...body }, record); return formatUpdate(record, "program element"); } catch (error) { return formatError(error); } }, ); - src/tools/program_elements.ts:3-3 (helper)Uses the apiPatch helper to send a PATCH request to the API endpoint.
import { apiDelete, apiGet, apiList, apiPatch, apiPost } from "../api"; - src/tools/program_elements.ts:10-10 (helper)Uses the formatUpdate helper to format the response.
formatUpdate,