delete_customer
Delete a customer by ID. Warning: Cascading delete may remove or orphan related data like addresses, payment methods, subscriptions, and invoices. Use with caution.
Instructions
Delete a customer by ID. DELETE /customers/{customerId}. WARNING: Cascading delete may remove or orphan related data (addresses, payment methods, subscriptions, invoices, etc.). Use with caution.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| customerId | Yes | Customer ID to delete (required) |
Implementation Reference
- The handler function that validates input via zod schema and calls customerService.deleteCustomer to perform the deletion.
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("; ")); } return handleToolCall(() => customerService.deleteCustomer(client, parsed.data.customerId)); - Zod schema defining the input: customerId (string, required).
const schema = z.object({ customerId: z.string().min(1, "customerId is required"), }); - src/tools/customers/deleteCustomer.ts:32-37 (registration)Export of the Tool object combining definition and handler for the delete_customer tool.
export const deleteCustomerTool: Tool = { definition, handler, }; - src/tools/customers/index.ts:31-37 (registration)registerCustomerTools() includes deleteCustomerTool in the array of exported tools.
export function registerCustomerTools(): Tool[] { return [ listCustomersTool, getCustomerTool, createCustomerTool, updateCustomerTool, deleteCustomerTool, - Service function that performs the DELETE /customers/{customerId} HTTP request.
export async function deleteCustomer( client: Client, customerId: string ): Promise<Record<string, unknown>> { const result = await client.delete<Record<string, unknown>>(`/customers/${customerId}`); return Object.keys(result ?? {}).length ? result : { success: true, message: "Customer disabled" }; }