get_account
Retrieve detailed information for a specific YNAB account, including balance and transaction history, to monitor financial status.
Instructions
[1 API call] Get details for a single account
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| budget_id | No | Budget ID or 'last-used' | last-used |
| account_id | Yes | The account ID |
Implementation Reference
- src/tools/accounts.ts:38-65 (handler)The `get_account` tool handler implementation, including input schema definition and the logic for fetching account details from the YNAB client.
server.registerTool("get_account", { title: "Get Account", description: "[1 API call] Get details for a single account", inputSchema: { budget_id: z.string().default("last-used").describe("Budget ID or 'last-used'"), account_id: z.string().describe("The account ID"), }, annotations: { readOnlyHint: true }, }, async ({ budget_id, account_id }) => { try { const response = await getClient().accounts.getAccountById(budget_id, account_id); const a = response.data.account; const lines = [ `Name: ${a.name}`, `Type: ${a.type}`, `Balance: ${formatCurrency(a.balance)}`, `Cleared Balance: ${formatCurrency(a.cleared_balance)}`, `Uncleared Balance: ${formatCurrency(a.uncleared_balance)}`, `On Budget: ${a.on_budget}`, `Closed: ${a.closed}`, `Note: ${a.note ?? "None"}`, `ID: ${a.id}`, ]; return textResult(lines.join("\n")); } catch (e: any) { return errorResult(e.message); } });