List bank accounts
lob_bank_accounts_listList bank accounts from your Lob account with pagination, date, and metadata filters. Pass include: ['total_count'] with limit:1 to get total count efficiently.
Instructions
List bank accounts on your Lob account. For 'how many bank accounts?' counts, pass include: ['total_count'] with limit: 1.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | How many results to return (default 10, max 100). | |
| before | No | Cursor for the previous page. | |
| after | No | Cursor for the next page. | |
| include | No | Response add-ons. Pass ['total_count'] alongside any filters and limit:1 to answer 'how many?' questions in a single call — far cheaper than paginating to count. Not accepted on nested order endpoints (buckslip/card orders) or /webhooks. | |
| date_created | No | ISO8601 date filter object with gt/gte/lt/lte keys, e.g. { gt: '2026-04-23T00:00:00Z' } for 'last 7 days'. Combine with include:['total_count'] and limit:1 for date-bounded counts. | |
| metadata | No | Filter by metadata key/value pairs. |
Implementation Reference
- src/tools/bank-accounts.ts:55-57 (handler)The handler function for lob_bank_accounts_list: performs a GET request to /bank_accounts with the list params passed as query parameters (with undefined values compacted out).
handler: async (args) => lob.request({ method: "GET", path: "/bank_accounts", query: compact(args) }), }); - src/tools/bank-accounts.ts:54-54 (schema)The input schema is spread from listParamsSchema.shape, which defines limit, before, after, include, date_created, and metadata fields (see src/schemas/common.ts lines 85-110).
inputSchema: { ...listParamsSchema.shape }, - src/tools/bank-accounts.ts:48-57 (registration)Registration of lob_bank_accounts_list inside registerBankAccountTools, called from src/tools/register.ts line 43.
registerTool(server, { name: "lob_bank_accounts_list", annotations: { title: "List bank accounts", ...ToolAnnotationPresets.read }, description: "List bank accounts on your Lob account. **For 'how many bank accounts?' counts, pass " + "`include: ['total_count']` with `limit: 1`.**", inputSchema: { ...listParamsSchema.shape }, handler: async (args) => lob.request({ method: "GET", path: "/bank_accounts", query: compact(args) }), }); - src/schemas/common.ts:152-158 (helper)The compact helper removes undefined values from args before sending as query params to the Lob API.
export function compact<T extends object>(obj: T): Partial<T> { const out: Record<string, unknown> = {}; for (const [k, v] of Object.entries(obj)) { if (v !== undefined) out[k] = v; } return out as Partial<T>; } - src/tools/helpers.ts:85-117 (helper)The registerTool helper that wraps the tool's handler with error handling and consistent response formatting before registering with the MCP server.
export function registerTool<TShape extends ZodRawShape>( server: McpServer, def: ToolDefinition<TShape>, ): void { const a = def.annotations ?? {}; server.registerTool( def.name, { title: a.title ?? def.name, description: def.description, inputSchema: def.inputSchema, annotations: { ...a, // Lob is always external; default the hint accordingly. openWorldHint: a.openWorldHint ?? true, }, }, // The SDK's ToolCallback type is parameterised over the exact ZodRawShape and // resists the generic erasure here. The runtime contract (validated args in, // CallToolResult out) is correct, so we bridge the type boundary with `as never`. (async (args: unknown, serverCtx: unknown): Promise<CallToolResult> => { try { const result = await def.handler(args as never, serverCtx); return { content: [{ type: "text", text: stringifyResult(result) }] }; } catch (err) { return { isError: true, content: [{ type: "text", text: formatErrorForTool(err) }], }; } }) as never, ); }