get_account
Retrieve a single account by providing its ID. Get account details directly from Eduframe.
Instructions
Get a single account
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | ID of the account to retrieve |
Implementation Reference
- src/tools/accounts.ts:55-63 (handler)Handler function for the get_account tool. Takes an account ID, calls apiGet to fetch the account from /accounts/{id}, logs the response, and formats it using formatShow.
async ({ id }) => { try { const record = await apiGet<EduframeRecord>(`/accounts/${id}`); void logResponse("get_account", { id }, record); return formatShow(record, "account"); } catch (error) { return formatError(error); } }, - src/tools/accounts.ts:53-53 (schema)Input schema for the get_account tool: requires a positive integer 'id' parameter.
inputSchema: { id: z.number().int().positive().describe("ID of the account to retrieve") }, - src/tools/accounts.ts:48-64 (registration)Registration of the get_account tool via server.registerTool inside the registerAccountTools function.
server.registerTool( "get_account", { description: "Get a single account", annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true }, inputSchema: { id: z.number().int().positive().describe("ID of the account to retrieve") }, }, async ({ id }) => { try { const record = await apiGet<EduframeRecord>(`/accounts/${id}`); void logResponse("get_account", { id }, record); return formatShow(record, "account"); } catch (error) { return formatError(error); } }, ); - src/api.ts:145-155 (helper)The apiGet helper that executes the actual GET request to the Eduframe API. Used by the get_account handler to fetch /accounts/{id}.
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 that formats a single account record into a human-readable CallToolResult. Used by the get_account handler.
export function formatShow(record: EduframeRecord, resourceName: string): CallToolResult { return { content: [ { type: "text", text: `${resourceName}:\n\n${formatJSON(record)}${RESPONSE_LOG_HINT}`, }, ], }; }