get_account
Retrieve current user account information including name, ID, email, and role for Codecks project management access.
Instructions
Get current account info (name, id, email, role).
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/read.ts:40-65 (registration)Tool registration for 'get_account' with metadata and handler that calls client.getAccount() and returns formatted JSON responseexport function registerReadTools(server: McpServer, client: CodecksClient): void { server.registerTool( "get_account", { title: "Get Account", description: "Get current account info (name, id, email, role).", inputSchema: z.object({}), }, async () => { try { const result = await client.getAccount(); return { content: [{ type: "text", text: JSON.stringify(finalizeToolResult(result)) }], }; } catch (err) { return { content: [ { type: "text", text: JSON.stringify(finalizeToolResult(handleError(err))), }, ], }; } }, );
- src/tools/read.ts:48-64 (handler)Tool handler that executes the get_account logic by calling client.getAccount() and formatting the result with error handlingasync () => { try { const result = await client.getAccount(); return { content: [{ type: "text", text: JSON.stringify(finalizeToolResult(result)) }], }; } catch (err) { return { content: [ { type: "text", text: JSON.stringify(finalizeToolResult(handleError(err))), }, ], }; } },
- src/client.ts:33-40 (handler)Implementation of getAccount() method that queries the Codecks API to retrieve account info (id, name, email, role) and throws SetupError if account cannot be fetchedasync getAccount(): Promise<Record<string, unknown>> { const result = await query({ _root: [{ account: ["id", "name", "email", "role"] }], }); const acct = result.account as Record<string, unknown> | undefined; if (!acct) throw new SetupError("[TOKEN_EXPIRED] Could not fetch account."); return acct; }