get_attendances
Retrieve attendance records with optional filtering by meeting ID and pagination control.
Instructions
Get all attendance records
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cursor | No | Cursor for fetching the next page of results | |
| per_page | No | Number of results per page (default: 25) | |
| meeting_id | No | Filter attendances on meeting_id |
Implementation Reference
- src/tools/attendances.ts:21-34 (handler)The async handler function that executes the 'get_attendances' tool logic. It calls apiList to GET /attendances with optional cursor, per_page, and meeting_id parameters, logs the response, formats the results, and returns next-cursor pagination info.
async ({ cursor, per_page, meeting_id }) => { try { const result = await apiList<EduframeRecord>("/attendances", { cursor, per_page, meeting_id }); void logResponse("get_attendances", { cursor, per_page, meeting_id }, result); const toolResult = formatList(result.records, "attendances"); if (result.nextCursor) { toolResult.content.push({ type: "text", text: `\nNext page cursor: ${result.nextCursor}` }); } return toolResult; } catch (error) { return formatError(error); } }, ); - src/tools/attendances.ts:12-19 (schema)Input schema for the 'get_attendances' tool, defining fields: cursor (optional string), per_page (optional positive int), meeting_id (optional int). Annotations mark it as read-only, non-destructive, idempotent.
{ description: "Get all attendance records", annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true }, inputSchema: { cursor: z.string().optional().describe("Cursor for fetching the next page of results"), per_page: z.number().int().positive().optional().describe("Number of results per page (default: 25)"), meeting_id: z.number().int().optional().describe("Filter attendances on meeting_id"), }, - src/tools/attendances.ts:10-34 (registration)Registration of the 'get_attendances' tool via server.registerTool() inside the registerAttendanceTools function.
server.registerTool( "get_attendances", { description: "Get all attendance records", annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true }, inputSchema: { cursor: z.string().optional().describe("Cursor for fetching the next page of results"), per_page: z.number().int().positive().optional().describe("Number of results per page (default: 25)"), meeting_id: z.number().int().optional().describe("Filter attendances on meeting_id"), }, }, async ({ cursor, per_page, meeting_id }) => { try { const result = await apiList<EduframeRecord>("/attendances", { cursor, per_page, meeting_id }); void logResponse("get_attendances", { cursor, per_page, meeting_id }, result); const toolResult = formatList(result.records, "attendances"); if (result.nextCursor) { toolResult.content.push({ type: "text", text: `\nNext page cursor: ${result.nextCursor}` }); } return toolResult; } catch (error) { return formatError(error); } }, ); - src/tools/index.ts:64-67 (registration)The registerAttendanceTools function is included in the tools array that is iterated by registerAllTools to register all tools on the MCP server.
const tools: Array<(server: McpServer) => void> = [ registerAccountTools, registerAffiliationTools, registerAttendanceTools, - src/api.ts:122-137 (helper)The apiList helper function used by the handler to perform a GET request to the Eduframe API, returning typed records and a nextCursor from the Link header.
export async function apiList<T>(path: string, query?: Record<string, QueryValue>): Promise<ListResult<T>> { const { token } = getConfig(); const url = buildUrl(path, query); const response = await fetch(url.toString(), { method: "GET", headers: buildHeaders(token), }); await checkResponse(response); const records = (await response.json()) as T[]; const nextCursor = parseNextCursor(response.headers.get("Link")); return { records, nextCursor }; }