list_accounts
Retrieve all bank accounts from connected financial institutions. Returns account UIDs, IBANs, names, and currencies for one or multiple connections.
Instructions
List all bank accounts across configured connections. Returns account UIDs, IBANs, names, and currencies.
Input 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 for the list_accounts tool. Loads config, iterates over connections (or a specific one), calls provider.listAccounts() for each, caches results, and returns aggregated bank accounts.
export 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 for list_accounts input: optional connectionId string. If omitted, queries all connections.
export const listAccountsSchema = z.object({ connectionId: z .string() .optional() .describe("Connection ID to query. If omitted, queries all connections."), }); - src/server.ts:24-30 (registration)Registration of the 'list_accounts' tool in the server's TOOLS array with name, description, and inputSchema.
const TOOLS = [ { 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:60-60 (registration)Handler dispatch for list_accounts in the server's handlers record. Parses args with schema and calls the main handler.
list_accounts: (args) => listAccounts(listAccountsSchema.parse(args)), - src/providers/base.ts:22-24 (helper)Abstract method definition for listAccounts in the base BankProvider class, defining the contract all providers must implement.
/** Fetch all accounts accessible via this connection. */ abstract listAccounts( config: Record<string, unknown>,