list_accounts
Retrieve all bank accounts with UIDs, IBANs, names, and currencies from configured financial connections using the bank-mcp server.
Instructions
List all bank accounts across configured connections. Returns account UIDs, IBANs, names, and currencies.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| connectionId | No | Connection ID to query. If omitted, queries all connections. |
Implementation Reference
- src/tools/list-accounts.ts:14-43 (handler)Main handler function that executes the list_accounts tool logic - retrieves connections, calls provider.listAccounts(), and returns tagged account list with caching supportexport async function listAccounts( args: z.infer<typeof listAccountsSchema>, ): Promise<BankAccount[]> { const config = loadConfig(); const connections = args.connectionId ? [getConnection(config, args.connectionId)] : getAllConnections(config); const allAccounts: BankAccount[] = []; for (const conn of connections) { const cacheKey = `accounts:${conn.id}`; const cached = cache.get<BankAccount[]>(cacheKey); if (cached) { allAccounts.push(...cached); continue; } const provider = getProvider(conn.provider); const accounts = await provider.listAccounts(conn.config); // Tag each account with its connection const tagged = accounts.map((a) => ({ ...a, connectionId: conn.id })); cache.set(cacheKey, tagged, TTL.ACCOUNTS); allAccounts.push(...tagged); } return allAccounts; }
- src/tools/list-accounts.ts:7-12 (schema)Zod schema defining the input validation for list_accounts tool - optional connectionId parameterexport const listAccountsSchema = z.object({ connectionId: z .string() .optional() .describe("Connection ID to query. If omitted, queries all connections."), });
- src/server.ts:25-30 (registration)Tool registration in the TOOLS array with name, description, and schema{ name: "list_accounts", description: "List all bank accounts across configured connections. Returns account UIDs, IBANs, names, and currencies.", inputSchema: z.toJSONSchema(listAccountsSchema), },
- src/server.ts:59-68 (registration)Handler registration mapping the list_accounts tool name to the handler function with schema validationconst handlers: Record<string, ToolHandler> = { list_accounts: (args) => listAccounts(listAccountsSchema.parse(args)), list_transactions: (args) => listTransactions(listTransactionsSchema.parse(args)), search_transactions: (args) => searchTransactions(searchTransactionsSchema.parse(args)), get_balance: (args) => getBalance(getBalanceSchema.parse(args)), spending_summary: (args) => spendingSummary(spendingSummarySchema.parse(args)), };
- src/providers/base.ts:22-25 (helper)Abstract method in BankProvider base class that all provider implementations must override to fetch accounts/** Fetch all accounts accessible via this connection. */ abstract listAccounts( config: Record<string, unknown>, ): Promise<BankAccount[]>;