set_attendance
Record or update a student's attendance for a specific meeting by supplying meeting and enrollment identifiers, selecting an attendance state, and optionally adding a comment.
Instructions
Set an attendance.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| meeting_id | Yes | Unique identifier of the meeting. | |
| enrollment_id | Yes | Unique identifier of the enrollment. | |
| state | No | Indicator of the attendance state. | |
| comment | No | Comment about this attendance. |
Implementation Reference
- src/tools/attendances.ts:36-57 (registration)Registration of the 'set_attendance' tool on the MCP server with input schema (meeting_id, enrollment_id, state, comment) and handler logic.
server.registerTool( "set_attendance", { description: "Set an attendance.", annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false }, inputSchema: { meeting_id: z.number().int().describe("Unique identifier of the meeting."), enrollment_id: z.number().int().describe("Unique identifier of the enrollment."), state: attendanceStateEnum.optional().describe("Indicator of the attendance state."), comment: z.string().optional().describe("Comment about this attendance."), }, }, async (body) => { try { const record = await apiPost<EduframeRecord>("/attendances/upsert", body); void logResponse("set_attendance", body, record); return formatCreate(record, "attendance"); } catch (error) { return formatError(error); } }, ); - src/tools/attendances.ts:48-56 (handler)Handler function for 'set_attendance': POSTs to /attendances/upsert, logs the response, and formats the created record.
async (body) => { try { const record = await apiPost<EduframeRecord>("/attendances/upsert", body); void logResponse("set_attendance", body, record); return formatCreate(record, "attendance"); } catch (error) { return formatError(error); } }, - src/tools/attendances.ts:7-7 (schema)Zod enum schema for attendance states used as input validation for the 'state' field of set_attendance.
const attendanceStateEnum = z.enum(["absent", "absent_with_leave", "attended", "blanco", "late"]); - src/tools/attendances.ts:41-46 (schema)Input schema for set_attendance tool defining required fields (meeting_id, enrollment_id) and optional fields (state, comment).
inputSchema: { meeting_id: z.number().int().describe("Unique identifier of the meeting."), enrollment_id: z.number().int().describe("Unique identifier of the enrollment."), state: attendanceStateEnum.optional().describe("Indicator of the attendance state."), comment: z.string().optional().describe("Comment about this attendance."), }, - src/api.ts:163-174 (helper)Helper function apiPost used by set_attendance handler to POST to the /attendances/upsert 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); }