get_category
Retrieve a specific category record by providing its unique ID. Use to access category details from the Eduframe system.
Instructions
Get a category record
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | ID of the categorie to retrieve |
Implementation Reference
- src/tools/categories.ts:40-56 (handler)The 'get_category' tool handler function. It calls apiGet('/categories/{id}') to fetch a single category record, logs the response, and formats the result using formatShow().
server.registerTool( "get_category", { description: "Get a category record", annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true }, inputSchema: { id: z.number().int().positive().describe("ID of the categorie to retrieve") }, }, async ({ id }) => { try { const record = await apiGet<EduframeRecord>(`/categories/${id}`); void logResponse("get_category", { id }, record); return formatShow(record, "categorie"); } catch (error) { return formatError(error); } }, ); - src/tools/categories.ts:42-45 (schema)Input schema for 'get_category' tool. Requires a positive integer 'id' parameter with description 'ID of the categorie to retrieve'.
{ description: "Get a category record", annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true }, inputSchema: { id: z.number().int().positive().describe("ID of the categorie to retrieve") }, - src/tools/categories.ts:40-56 (registration)Registration of 'get_category' tool via server.registerTool() with readOnlyHint=true, destructiveHint=false, idempotentHint=true annotations.
server.registerTool( "get_category", { description: "Get a category record", annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true }, inputSchema: { id: z.number().int().positive().describe("ID of the categorie to retrieve") }, }, async ({ id }) => { try { const record = await apiGet<EduframeRecord>(`/categories/${id}`); void logResponse("get_category", { id }, record); return formatShow(record, "categorie"); } catch (error) { return formatError(error); } }, ); - src/tools/index.ts:128-132 (registration)Top-level registration: registerAllTools() iterates over all tool registration functions including registerCategorieTools which registers 'get_category'.
export function registerAllTools(server: McpServer): void { for (const register of tools) { register(server); } } - src/api.ts:145-155 (helper)The apiGet() helper function used by the 'get_category' handler to perform a GET request to the Eduframe API.
export async function apiGet<T>(path: string, query?: Record<string, QueryValue>): Promise<T> { const { token } = getConfig(); const url = buildUrl(path, query); const response = await fetch(url.toString(), { method: "GET", headers: buildHeaders(token), }); return handleResponse<T>(response); }