get_referrals
Retrieve all referral records with optional pagination using a cursor and per_page parameter.
Instructions
Get all referral 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) |
Implementation Reference
- src/tools/referrals.ts:18-31 (handler)The async handler function that calls the API to fetch referrals, logs the response, formats the result, and returns it with optional pagination cursor.
async ({ cursor, per_page }) => { try { const result = await apiList<EduframeRecord>("/referrals", { cursor, per_page }); void logResponse("get_referrals", { cursor, per_page }, result); const toolResult = formatList(result.records, "referrals"); if (result.nextCursor) { toolResult.content.push({ type: "text", text: `\nNext page cursor: ${result.nextCursor}` }); } return toolResult; } catch (error) { return formatError(error); } }, ); - src/tools/referrals.ts:12-16 (schema)The input schema using Zod, defining optional 'cursor' (string) and 'per_page' (positive integer) parameters.
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)"), }, - src/tools/referrals.ts:7-31 (registration)The registration function 'registerReferralTools' that calls server.registerTool() with the name 'get_referrals', description, annotations, input schema, and handler.
export function registerReferralTools(server: McpServer): void { server.registerTool( "get_referrals", { description: "Get all referral 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)"), }, }, async ({ cursor, per_page }) => { try { const result = await apiList<EduframeRecord>("/referrals", { cursor, per_page }); void logResponse("get_referrals", { cursor, per_page }, result); const toolResult = formatList(result.records, "referrals"); 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:128-132 (registration)The top-level registration entry point that iterates over all tool registrations (including registerReferralTools) and calls each with the server instance.
export function registerAllTools(server: McpServer): void { for (const register of tools) { register(server); } }