get_teacher_roles
Retrieve all teacher roles with pagination support. Use cursor and per_page parameters to control the result set.
Instructions
Get all teacher roles
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) |
Implementation Reference
- src/tools/teacher_roles.ts:26-38 (handler)The async handler function that executes the 'get_teacher_roles' tool logic: calls apiList to GET /teacher_roles with cursor/per_page, logs the response, formats the list result, and appends a next-page cursor if present.
async ({ cursor, per_page }) => { try { const result = await apiList<EduframeRecord>("/teacher_roles", { cursor, per_page }); void logResponse("get_teacher_roles", { cursor, per_page }, result); const toolResult = formatList(result.records, "teacher roles"); if (result.nextCursor) { toolResult.content.push({ type: "text", text: `\nNext page cursor: ${result.nextCursor}` }); } return toolResult; } catch (error) { return formatError(error); } }, - src/tools/teacher_roles.ts:21-24 (schema)Input schema for 'get_teacher_roles' using Zod: optional 'cursor' (string) and 'per_page' (positive integer).
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)"), }, - src/tools/teacher_roles.ts:15-39 (registration)Tool registration call using server.registerTool('get_teacher_roles', ...) inside registerTeacherRoleTools, with description, annotations (readOnlyHint=true), and the handler.
export function registerTeacherRoleTools(server: McpServer): void { server.registerTool( "get_teacher_roles", { description: "Get all teacher roles", 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)"), }, }, async ({ cursor, per_page }) => { try { const result = await apiList<EduframeRecord>("/teacher_roles", { cursor, per_page }); void logResponse("get_teacher_roles", { cursor, per_page }, result); const toolResult = formatList(result.records, "teacher roles"); 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:57-57 (registration)Import of registerTeacherRoleTools from './teacher_roles'.
import { registerTeacherRoleTools } from "./teacher_roles"; - src/tools/index.ts:120-120 (registration)registerTeacherRoleTools added to the tools array, which is iterated by registerAllTools.
registerTeacherRoleTools,