get_catalog_variant
Retrieve a catalog variant record by its ID. Access variant details for use in lead management and educational resource workflows.
Instructions
Get a catalog variant record
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | ID of the catalog variant to retrieve |
Implementation Reference
- src/tools/catalog_variants.ts:61-69 (handler)The handler function for the 'get_catalog_variant' tool. It takes { id }, calls apiGet to fetch the catalog variant from '/catalog/variants/{id}', logs the response, and formats the result using formatShow.
async ({ id }) => { try { const record = await apiGet<EduframeRecord>(`/catalog/variants/${id}`); void logResponse("get_catalog_variant", { id }, record); return formatShow(record, "catalog variant"); } catch (error) { return formatError(error); } }, - src/tools/catalog_variants.ts:57-59 (schema)Input schema for the 'get_catalog_variant' tool: requires a single 'id' parameter (positive integer) describing the catalog variant to retrieve.
description: "Get a catalog variant record", annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true }, inputSchema: { id: z.number().int().positive().describe("ID of the catalog variant to retrieve") }, - src/tools/catalog_variants.ts:54-70 (registration)Registration of the 'get_catalog_variant' tool via server.registerTool() within registerCatalogVariantTools.
server.registerTool( "get_catalog_variant", { description: "Get a catalog variant record", annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true }, inputSchema: { id: z.number().int().positive().describe("ID of the catalog variant to retrieve") }, }, async ({ id }) => { try { const record = await apiGet<EduframeRecord>(`/catalog/variants/${id}`); void logResponse("get_catalog_variant", { id }, record); return formatShow(record, "catalog variant"); } catch (error) { return formatError(error); } }, ); - src/api.ts:145-155 (helper)The apiGet helper function used by the handler to perform the 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); } - src/formatters.ts:68-77 (helper)The formatShow helper used by the handler to format the retrieved catalog variant record as a text response.
export function formatShow(record: EduframeRecord, resourceName: string): CallToolResult { return { content: [ { type: "text", text: `${resourceName}:\n\n${formatJSON(record)}${RESPONSE_LOG_HINT}`, }, ], }; }