get_teacher_role
Retrieve a teacher role by ID to view its details. This tool fetches role information from Eduframe.
Instructions
Get a teacher role
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | ID of the teacher role to retrieve |
Implementation Reference
- src/tools/teacher_roles.ts:48-56 (handler)Handler function for the 'get_teacher_role' tool. Calls apiGet to fetch a single teacher role by ID, logs the response, and formats the result.
async ({ id }) => { try { const record = await apiGet<EduframeRecord>(`/teacher_roles/${id}`); void logResponse("get_teacher_role", { id }, record); return formatShow(record, "teacher role"); } catch (error) { return formatError(error); } }, - src/tools/teacher_roles.ts:43-47 (schema)Input schema for 'get_teacher_role' - accepts 'id' (positive integer) as the required parameter.
{ description: "Get a teacher role", annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true }, inputSchema: { id: z.number().int().positive().describe("ID of the teacher role to retrieve") }, }, - src/tools/teacher_roles.ts:41-57 (registration)Registration of 'get_teacher_role' tool via server.registerTool within the registerTeacherRoleTools function.
server.registerTool( "get_teacher_role", { description: "Get a teacher role", annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true }, inputSchema: { id: z.number().int().positive().describe("ID of the teacher role to retrieve") }, }, async ({ id }) => { try { const record = await apiGet<EduframeRecord>(`/teacher_roles/${id}`); void logResponse("get_teacher_role", { id }, record); return formatShow(record, "teacher role"); } catch (error) { return formatError(error); } }, ); - src/tools/index.ts:120-132 (registration)registerTeacherRoleTools is included in the tools array and called by registerAllTools.
registerTeacherRoleTools, registerTeacherTools, registerTheseTools, registerUserTools, registerWebhookNotificationTools, registerWebhookTools, ]; export function registerAllTools(server: McpServer): void { for (const register of tools) { register(server); } } - src/formatters.ts:68-77 (helper)formatShow helper that formats the API response into a CallToolResult with human-readable JSON output.
export function formatShow(record: EduframeRecord, resourceName: string): CallToolResult { return { content: [ { type: "text", text: `${resourceName}:\n\n${formatJSON(record)}${RESPONSE_LOG_HINT}`, }, ], }; }