bulk_validate
Validate up to 100 postal addresses in a single request. Returns an array of validated addresses or errors.
Instructions
Validate up to 100 postal addresses in a single request. Consumes 1 credit per address. Returns an array where each entry is either a validated address or an error.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| addresses | Yes | Array of address strings to validate (max 100). |
Implementation Reference
- src/index.ts:58-81 (registration)Tool 'bulk_validate' is registered via server.registerTool() with zod inputSchema (array of 1-100 strings) and handler.
server.registerTool( "bulk_validate", { description: "Validate up to 100 postal addresses in a single request. Consumes 1 credit per address. Returns an array where each entry is either a validated address or an error.", inputSchema: { addresses: z .array(z.string().min(1)) .min(1) .max(100) .describe("Array of address strings to validate (max 100)."), }, }, async ({ addresses }) => { try { const result = await client.bulkValidate(addresses); return { content: [{ type: "text", text: JSON.stringify(shapeMany(result), null, 2) }], }; } catch (error) { return errorResult(error); } } ); - src/client.ts:25-30 (handler)Client method bulkValidate() that POSTs addresses to /accounts/{accountId}/addresses/batch.
async bulkValidate(addresses: string[]) { return this.post(`/accounts/${this.accountId}/addresses/batch`, { addresses, sync: true, }); } - src/shape.ts:39-42 (helper)shapeMany() helper transforms the bulk validate API response envelope into a ShapedAddress[] array.
export function shapeMany(envelope: unknown): ShapedAddress[] { const entries = ((envelope as { addresses?: RawAddress[] })?.addresses ?? []) as RawAddress[]; return entries.map(shape); }