Verify an international address
lob_intl_verifications_createVerify a non-US address to check deliverability and get standardized address components for the destination country.
Instructions
Verify a single non-US address. Returns deliverability status and standardized components for the destination country.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| primary_line | Yes | Primary street address line. | |
| secondary_line | No | ||
| city | No | ||
| state | No | State, province, or region. | |
| postal_code | No | ||
| country | Yes | Two-letter ISO country code. | |
| address | No | Full single-line address (alternative to fields above). | |
| recipient | No | ||
| 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/verifications.ts:107-114 (handler)Handler function for lob_intl_verifications_create — makes a POST request to Lob's /intl_verifications endpoint with the validated arguments merged with extra params.
handler: async (args) => { const { extra, ...rest } = args; return lob.request({ method: "POST", path: "/intl_verifications", body: withExtra(rest, extra), }); }, - src/tools/verifications.ts:101-106 (schema)Input schema for lob_intl_verifications_create — spreads intlAddressInputSchema (primary_line, secondary_line, city, state, postal_code, country) plus optional address, recipient, and extra params.
inputSchema: { ...intlAddressInputSchema, address: z.string().optional().describe("Full single-line address (alternative to fields above)."), recipient: z.string().optional(), extra: extraParamsSchema, }, - src/tools/verifications.ts:95-115 (registration)Registration of lob_intl_verifications_create tool via registerTool() helper, within the registerVerificationTools() function called from register.ts
registerTool(server, { name: "lob_intl_verifications_create", annotations: { title: "Verify an international address", ...ToolAnnotationPresets.read }, description: "Verify a single non-US address. Returns deliverability status and standardized components for " + "the destination country.", inputSchema: { ...intlAddressInputSchema, address: z.string().optional().describe("Full single-line address (alternative to fields above)."), recipient: z.string().optional(), extra: extraParamsSchema, }, handler: async (args) => { const { extra, ...rest } = args; return lob.request({ method: "POST", path: "/intl_verifications", body: withExtra(rest, extra), }); }, }); - src/schemas/common.ts:161-166 (helper)withExtra helper — merges extra params with the typed payload, with explicit fields taking precedence over extra.
export function withExtra( payload: object, extra: Record<string, unknown> | undefined, ): Record<string, unknown> { return { ...(extra ?? {}), ...compact(payload) }; } - src/tools/helpers.ts:85-117 (helper)registerTool helper — wraps the tool definition with error handling and registers it 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, ); } - src/tools/verifications.ts:27-34 (schema)The intlAddressInputSchema used as the base for the input schema of lob_intl_verifications_create.
const intlAddressInputSchema = { primary_line: z.string().describe("Primary street address line."), secondary_line: z.string().optional(), city: z.string().optional(), state: z.string().optional().describe("State, province, or region."), postal_code: z.string().optional(), country: z.string().length(2).describe("Two-letter ISO country code."), };