get_course_location
Retrieve a course location record by specifying its ID. Access stored location details to manage course logistics.
Instructions
Get a course location record
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | ID of the course location to retrieve |
Implementation Reference
- src/tools/course_locations.ts:48-56 (handler)The handler function for the 'get_course_location' tool. Takes an 'id' parameter, fetches the course location record via apiGet from /course_locations/{id}, logs the response, and returns the formatted result using formatShow.
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); } }, - src/tools/course_locations.ts:43-46 (schema)The schema/input definition for the 'get_course_location' tool. Specifies the required 'id' parameter (positive integer) and read-only annotations.
{ 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") }, - src/tools/course_locations.ts:41-57 (registration)Registration of the 'get_course_location' tool via server.registerTool() within registerCourseLocationTools().
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); } }, ); - src/tools/index.ts:74-74 (registration)Registration function included in the tools array in src/tools/index.ts, which is called by registerAllTools() to register all tools including course location tools on the MCP server.
registerCourseLocationTools, - src/formatters.ts:68-77 (helper)Helper function formatShow used by the handler to format the retrieved course location record as a human-readable text result.
export function formatShow(record: EduframeRecord, resourceName: string): CallToolResult { return { content: [ { type: "text", text: `${resourceName}:\n\n${formatJSON(record)}${RESPONSE_LOG_HINT}`, }, ], }; }