get_course_locations
Retrieve all course location records from Eduframe. Paginate results with optional cursor and per_page parameters.
Instructions
Get all course location 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/course_locations.ts:26-38 (handler)The handler function for the 'get_course_locations' tool. Fetches all course location records from the API via apiList, logs the response, formats results using formatList, and appends a next-page cursor if available.
async ({ cursor, per_page }) => { try { const result = await apiList<EduframeRecord>("/course_locations", { cursor, per_page }); void logResponse("get_course_locations", { cursor, per_page }, result); const toolResult = formatList(result.records, "course locations"); if (result.nextCursor) { toolResult.content.push({ type: "text", text: `\nNext page cursor: ${result.nextCursor}` }); } return toolResult; } catch (error) { return formatError(error); } }, - src/tools/course_locations.ts:18-24 (schema)The schema/input definition for the 'get_course_locations' tool, defining optional 'cursor' (string) and 'per_page' (positive int) parameters with Zod validation.
{ description: "Get all course location 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)"), }, - src/tools/course_locations.ts:16-17 (registration)Registration of the 'get_course_locations' tool via server.registerTool within registerCourseLocationTools.
server.registerTool( "get_course_locations", - src/tools/course_locations.ts:15-139 (registration)The register function that wraps all course location tool registrations, called from the central tool index.
export function registerCourseLocationTools(server: McpServer): void { server.registerTool( "get_course_locations", { description: "Get all course location 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>("/course_locations", { cursor, per_page }); void logResponse("get_course_locations", { cursor, per_page }, result); const toolResult = formatList(result.records, "course locations"); if (result.nextCursor) { toolResult.content.push({ type: "text", text: `\nNext page cursor: ${result.nextCursor}` }); } return toolResult; } catch (error) { return formatError(error); } }, ); server.registerTool( "get_course_location", { description: "Get a course location record", annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true }, inputSchema: { id: z.number().int().positive().describe("ID of the course location to retrieve") }, }, async ({ id }) => { try { const record = await apiGet<EduframeRecord>(`/course_locations/${id}`); void logResponse("get_course_location", { id }, record); return formatShow(record, "course location"); } catch (error) { return formatError(error); } }, ); server.registerTool( "create_course_location", { description: "Create a course location.", annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false }, inputSchema: { name: z.string().describe("Name of the location where the course is held."), address_attributes: z .object({ addressee: z.string().optional().describe("The addressee of the address."), address: z.string().describe("Concatenation of the street and house number."), address_line2: z.string().optional().describe("A string representing the second line of the address."), postal_code: z.string().describe("A string representing the postal code."), city: z.string().describe("A string representing the city."), state_province: z.string().optional().describe("An letter USA state code."), country: z.string().describe("An ISO3166 two-letter country code."), }) .optional(), }, }, async (body) => { try { const record = await apiPost<EduframeRecord>("/course_locations", body); void logResponse("create_course_location", body, record); return formatCreate(record, "course location"); } catch (error) { return formatError(error); } }, ); server.registerTool( "update_course_location", { description: "Update a course location.", annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true }, inputSchema: { id: z.number().int().positive().describe("ID of the course location to update"), name: z.string().optional().describe("Name of the location where the course is held."), address_attributes: z .object({ addressee: z.string().optional().describe("The addressee of the address."), address: z.string().optional().describe("Concatenation of the street and house number."), address_line2: z.string().optional().describe("A string representing the second line of the address."), postal_code: z.string().optional().describe("A string representing the postal code."), city: z.string().optional().describe("A string representing the city."), state_province: z.string().optional().describe("An letter USA state code."), country: z.string().optional().describe("An ISO3166 two-letter country code."), }) .optional(), }, }, async ({ id, ...body }) => { try { const record = await apiPatch<EduframeRecord>(`/course_locations/${id}`, body); void logResponse("update_course_location", { id, ...body }, record); return formatUpdate(record, "course location"); } catch (error) { return formatError(error); } }, ); server.registerTool( "delete_course_location", { description: "Delete a course location.", annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: true }, inputSchema: { id: z.number().int().positive().describe("ID of the course location to delete") }, }, async ({ id }) => { try { const record = await apiDelete<EduframeRecord>(`/course_locations/${id}`); void logResponse("delete_course_location", { id }, record); return formatDelete(record, "course location"); } catch (error) { return formatError(error); } }, ); } - src/tools/index.ts:74-74 (registration)Central registration: registerCourseLocationTools is listed in the tools array and invoked by registerAllTools.
registerCourseLocationTools,