delete_customer_address
Delete a customer's address book entry by providing the customer ID and address ID. Removes the specified address from the customer's address list.
Instructions
Delete an address book entry. DELETE /customers/{customerId}/addressbooks/{addressId}.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| customerId | Yes | Customer ID (required) | |
| addressId | Yes | Address book entry ID (required) |
Implementation Reference
- The handler function that validates input with zod schema and calls the service layer to delete a customer address.
async function handler(client: Client, args: Record<string, unknown> | undefined) { const parsed = schema.safeParse(args); if (!parsed.success) { return errorResult(parsed.error.errors.map((e) => e.message).join("; ")); } const { customerId, addressId } = parsed.data; return handleToolCall(() => customerService.deleteCustomerAddress(client, customerId, addressId) ); } - Zod schema defining the required inputs: customerId and addressId (both strings, min length 1).
const schema = z.object({ customerId: z.string().min(1, "customerId is required"), addressId: z.string().min(1, "addressId is required"), }); - Tool definition/inputSchema for 'delete_customer_address' with name, description, and JSON Schema input properties.
const definition = { name: "delete_customer_address", description: "Delete an address book entry. DELETE /customers/{customerId}/addressbooks/{addressId}.", inputSchema: { type: "object" as const, properties: { customerId: { type: "string", description: "Customer ID (required)" }, addressId: { type: "string", description: "Address book entry ID (required)" }, }, required: ["customerId", "addressId"], }, }; - src/tools/customers/index.ts:46-46 (registration)Registration of deleteCustomerAddressTool in the registerCustomerTools() function array, line 46.
deleteCustomerAddressTool, - Service function that performs the actual DELETE HTTP call to /customers/{customerId}/addressbooks/{addressId}.
export async function deleteCustomerAddress( client: Client, customerId: string, addressId: string ): Promise<Record<string, unknown>> { const result = await client.delete<Record<string, unknown>>( `/customers/${customerId}/addressbooks/${addressId}` ); return Object.keys(result ?? {}).length ? result : { success: true, message: "Address deleted" }; }