Create a bank account
lob_bank_accounts_createRegister a US bank account to draw checks. Provide routing number, account number, account type, and signatory. Verify the account before use in check creation.
Instructions
Register a bank account that can be used to draw checks. Requires routing number, account number, account type, and signatory. Bank accounts must be verified (lob_bank_accounts_verify) before use in lob_checks_create.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| routing_number | Yes | 9-digit US routing number. | |
| account_number | Yes | Account number. | |
| account_type | Yes | ||
| signatory | Yes | Name of authorized signer printed on checks. | |
| description | No | ||
| metadata | No | Up to 20 string key/value pairs of arbitrary metadata to attach to the resource. | |
| extra | No | Additional Lob API parameters not enumerated above. Merged into the request body verbatim. See https://docs.lob.com for the full parameter list per resource. |
Implementation Reference
- src/tools/bank-accounts.ts:22-46 (handler)Handler function for lob_bank_accounts_create: makes a POST request to /bank_accounts with validated args (routing_number, account_number, account_type, signatory, optional description/metadata/extra). Sends the request via LobClient.
registerTool(server, { name: "lob_bank_accounts_create", annotations: { title: "Create a bank account", ...ToolAnnotationPresets.mutate }, description: "Register a bank account that can be used to draw checks. Requires routing number, account " + "number, account type, and signatory. Bank accounts must be verified (`lob_bank_accounts_verify`) " + "before use in `lob_checks_create`.", inputSchema: { routing_number: z.string().regex(/^\d{9}$/).describe("9-digit US routing number."), account_number: z.string().describe("Account number."), account_type: z.enum(["company", "individual"]), signatory: z.string().max(100).describe("Name of authorized signer printed on checks."), description: z.string().max(255).optional(), metadata: metadataSchema, extra: extraParamsSchema, }, handler: async (args) => { const { extra, ...rest } = args; return lob.request({ method: "POST", path: "/bank_accounts", body: withExtra(rest, extra), }); }, }); - src/tools/bank-accounts.ts:29-37 (schema)Zod input schema for lob_bank_accounts_create: routing_number (9-digit regex), account_number (string), account_type (enum: company/individual), signatory (max 100 chars), description (max 255, optional), metadata (optional key-value record), extra (optional escape hatch for unlisted Lob API params).
inputSchema: { routing_number: z.string().regex(/^\d{9}$/).describe("9-digit US routing number."), account_number: z.string().describe("Account number."), account_type: z.enum(["company", "individual"]), signatory: z.string().max(100).describe("Name of authorized signer printed on checks."), description: z.string().max(255).optional(), metadata: metadataSchema, extra: extraParamsSchema, }, - src/tools/register.ts:43-43 (registration)Registration: registerBankAccountTools is called from registerAllTools, which wires all resource-group tools into the MCP server.
registerBankAccountTools(server, lob); - src/tools/helpers.ts:85-117 (helper)The registerTool helper wraps the SDK's server.registerTool with consistent error handling. Catches handler errors and returns them as isError tool results.
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, ); } - src/schemas/common.ts:161-166 (helper)The withExtra helper merges the typed payload with the extra escape-hatch params, with typed fields taking precedence.
export function withExtra( payload: object, extra: Record<string, unknown> | undefined, ): Record<string, unknown> { return { ...(extra ?? {}), ...compact(payload) }; }