create_planned_course
Create a planned course instance by setting its course variant, type, cost, and optional attributes such as dates and participant limits.
Instructions
Create a planned course.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| is_published | No | Boolean if is published on the website. | |
| course_id | Yes | Unique identifier of the course. | |
| type | Yes | The type of the course. | |
| start_date | No | Date at which the planned course starts. Only needed for fixed planned courses. | |
| end_date | No | Date at which the planned course ends. Only needed for fixed planned courses. | |
| min_participants | No | A number representing the minimum number of participants that can enroll for the planned course. | |
| max_participants | No | A number representing the maximum number of participants that can enroll for the planned course. | |
| cost_scheme | No | The cost schema that the payment will follow for the specified course. | |
| cost | Yes | The price to be paid for this planned course. Required if cost_scheme is student (default value) or order. | |
| course_variant_id | No | Unique identifier of the course variant. | |
| course_location_id | No | Unique identifier of the course location. | |
| duration | No | The period of time of the planned course in days. Only needed for flexible planned courses. | |
| teacher_ids | No | The ids of the teachers in the course | |
| custom | No | ||
| custom_associations | No |
Implementation Reference
- src/tools/planned_courses.ts:163-171 (handler)The handler function for 'create_planned_course' tool. It receives the body (input params), calls apiPost to POST to '/planned_courses', logs the response, and formats the result as a successful creation.
async (body) => { try { const record = await apiPost<EduframeRecord>("/planned_courses", body); void logResponse("create_planned_course", body, record); return formatCreate(record, "planned course"); } catch (error) { return formatError(error); } }, - src/tools/planned_courses.ts:119-161 (schema)The input schema for 'create_planned_course' defining all valid parameters: is_published, course_id, type, start_date, end_date, min_participants, max_participants, cost_scheme, cost, course_variant_id, course_location_id, duration, teacher_ids, custom, custom_associations.
{ description: "Create a planned course.", annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false }, inputSchema: { is_published: z.boolean().optional().describe("Boolean if is published on the website."), course_id: z.number().int().describe("Unique identifier of the course."), type: plannedCourseTypeEnum.describe("The type of the course."), start_date: z .string() .optional() .describe("Date at which the planned course starts. Only needed for fixed planned courses."), end_date: z .string() .optional() .describe("Date at which the planned course ends. Only needed for fixed planned courses."), min_participants: z .number() .int() .optional() .describe("A number representing the minimum number of participants that can enroll for the planned course."), max_participants: z .number() .int() .optional() .describe("A number representing the maximum number of participants that can enroll for the planned course."), cost_scheme: plannedCourseCostSchemeEnum .optional() .describe("The cost schema that the payment will follow for the specified course."), cost: z .number() .describe( "The price to be paid for this planned course. Required if cost_scheme is student (default value) or order.", ), course_variant_id: z.number().int().optional().describe("Unique identifier of the course variant."), course_location_id: z.number().int().optional().describe("Unique identifier of the course location."), duration: z .number() .optional() .describe("The period of time of the planned course in days. Only needed for flexible planned courses."), teacher_ids: z.array(z.number().int()).optional().describe("The ids of the teachers in the course"), custom: z.record(z.unknown()).optional(), custom_associations: z.record(z.unknown()).optional(), }, - src/tools/planned_courses.ts:117-172 (registration)Registration of 'create_planned_course' tool via server.registerTool() within registerPlannedCourseTools().
server.registerTool( "create_planned_course", { description: "Create a planned course.", annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false }, inputSchema: { is_published: z.boolean().optional().describe("Boolean if is published on the website."), course_id: z.number().int().describe("Unique identifier of the course."), type: plannedCourseTypeEnum.describe("The type of the course."), start_date: z .string() .optional() .describe("Date at which the planned course starts. Only needed for fixed planned courses."), end_date: z .string() .optional() .describe("Date at which the planned course ends. Only needed for fixed planned courses."), min_participants: z .number() .int() .optional() .describe("A number representing the minimum number of participants that can enroll for the planned course."), max_participants: z .number() .int() .optional() .describe("A number representing the maximum number of participants that can enroll for the planned course."), cost_scheme: plannedCourseCostSchemeEnum .optional() .describe("The cost schema that the payment will follow for the specified course."), cost: z .number() .describe( "The price to be paid for this planned course. Required if cost_scheme is student (default value) or order.", ), course_variant_id: z.number().int().optional().describe("Unique identifier of the course variant."), course_location_id: z.number().int().optional().describe("Unique identifier of the course location."), duration: z .number() .optional() .describe("The period of time of the planned course in days. Only needed for flexible planned courses."), teacher_ids: z.array(z.number().int()).optional().describe("The ids of the teachers in the course"), custom: z.record(z.unknown()).optional(), custom_associations: z.record(z.unknown()).optional(), }, }, async (body) => { try { const record = await apiPost<EduframeRecord>("/planned_courses", body); void logResponse("create_planned_course", body, record); return formatCreate(record, "planned course"); } catch (error) { return formatError(error); } }, ); - src/tools/index.ts:103-103 (registration)The tool registration function registerPlannedCourseTools is included in the list of all tool registrations, called during server setup.
registerPlannedCourseTools, - src/api.ts:163-173 (helper)The apiPost helper function used by the handler to POST data to the Eduframe API endpoint.
export async function apiPost<T>(path: string, body: unknown): Promise<T> { const { token } = getConfig(); const url = buildUrl(path); const response = await fetch(url.toString(), { method: "POST", headers: buildHeaders(token), body: JSON.stringify(body), }); return handleResponse<T>(response);