create_teacher_enrollment_by_planned_course_id
Assign a teacher to a planned course by providing the course ID and teacher ID, with an optional role. Automates teacher enrollment.
Instructions
Enroll a teacher to the given planned course.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| planned_course_id | Yes | ID of the teacher enrollment | |
| teacher_id | Yes | Unique identifier of the teacher. | |
| teacher_role_id | No | Unique identifier of the teacher role. |
Implementation Reference
- src/tools/teacher_enrollments.ts:112-132 (handler)Handler for the 'create_teacher_enrollment_by_planned_course_id' tool. Registers via server.registerTool, posts to /planned_courses/{planned_course_id}/teacher_enrollments via apiPost, and uses formatShow to return the result.
server.registerTool( "create_teacher_enrollment_by_planned_course_id", { description: "Enroll a teacher to the given planned course.", annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true }, inputSchema: { planned_course_id: z.number().int().positive().describe("ID of the teacher enrollment"), teacher_id: z.number().int().describe("Unique identifier of the teacher."), teacher_role_id: z.number().int().optional().describe("Unique identifier of the teacher role."), }, }, async ({ planned_course_id, ...body }) => { try { const record = await apiPost<EduframeRecord>(`/planned_courses/${planned_course_id}/teacher_enrollments`, body); void logResponse("create_teacher_enrollment_by_planned_course_id", { planned_course_id, ...body }, record); return formatShow(record, "teacher enrollment"); } catch (error) { return formatError(error); } }, ); - Input schema definition: expected parameters are planned_course_id (required positive int), teacher_id (required int), and teacher_role_id (optional int).
inputSchema: { planned_course_id: z.number().int().positive().describe("ID of the teacher enrollment"), teacher_id: z.number().int().describe("Unique identifier of the teacher."), teacher_role_id: z.number().int().optional().describe("Unique identifier of the teacher role."), }, - src/tools/teacher_enrollments.ts:113-113 (registration)Tool registration name: 'create_teacher_enrollment_by_planned_course_id' passed as first argument to server.registerTool.
"create_teacher_enrollment_by_planned_course_id", - src/tools/index.ts:56-56 (registration)Registration wiring: registerTeacherEnrollmentTools is imported from ./teacher_enrollments and included in the tools array that registerAllTools iterates over.
import { registerTeacherEnrollmentTools } from "./teacher_enrollments"; - src/formatters.ts:68-77 (helper)formatShow helper used by the handler to format the created teacher enrollment record as a text/CallToolResult response.
export function formatShow(record: EduframeRecord, resourceName: string): CallToolResult { return { content: [ { type: "text", text: `${resourceName}:\n\n${formatJSON(record)}${RESPONSE_LOG_HINT}`, }, ], }; }