update_customer
Update an existing customer's details including name, email, phone, business information, locale, currency, tax exemption, and status using their customer ID.
Instructions
Update an existing customer. PUT /customers/{customerId}. Required: customerId. Optional: firstName, lastName, email, businessName, locale, phoneNum, phoneExt, preferredCurrency, taxExempt, status (active|disabled|archived).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| customerId | Yes | Customer ID to update (required) | |
| firstName | No | Customer first name | |
| lastName | No | Customer last name | |
| No | Customer email | ||
| businessName | No | Business name | |
| locale | No | Locale code | |
| phoneNum | No | Phone number | |
| phoneExt | No | Phone extension | |
| preferredCurrency | No | Preferred currency code | |
| taxExempt | No | Whether customer is tax exempt | |
| status | No | Customer status: active, disabled, or archived |
Implementation Reference
- Handler function that validates input with Zod schema, extracts customerId, and delegates to customerService.updateCustomer.
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.path.join(".")}: ${e.message}`).join("; ")); } const { customerId, ...rest } = parsed.data; return handleToolCall(() => customerService.updateCustomer(client, customerId, rest)); } - Zod schema for input validation of update_customer: requires customerId, optional firstName, lastName, email, businessName, locale, phoneNum, phoneExt, preferredCurrency, taxExempt, status.
const schema = z.object({ customerId: z.string().min(1, "customerId is required"), firstName: z.string().min(1).optional(), lastName: z.string().min(1).optional(), email: z.string().email().optional(), businessName: z.string().optional(), locale: z.string().optional(), phoneNum: z.string().optional(), phoneExt: z.string().optional(), preferredCurrency: z.string().optional(), taxExempt: z.boolean().optional(), status: z.enum(["active", "disabled", "archived"]).optional(), }); - src/tools/customers/updateCustomer.ts:53-56 (registration)Exported Tool object combining the definition and handler, named updateCustomerTool.
export const updateCustomerTool: Tool = { definition, handler, }; - src/tools/customers/index.ts:31-36 (registration)registerCustomerTools() returns an array of all customer tools including updateCustomerTool for registration.
export function registerCustomerTools(): Tool[] { return [ listCustomersTool, getCustomerTool, createCustomerTool, updateCustomerTool, - Service-layer updateCustomer function that strips undefined fields from body and performs PUT /customers/{customerId}.
export async function updateCustomer( client: Client, customerId: string, body: UpdateCustomerBody ): Promise<Customer> { const payload = Object.fromEntries( Object.entries(body).filter(([, v]) => v !== undefined) ) as UpdateCustomerBody; return client.put<Customer>( `/customers/${customerId}`, Object.keys(payload).length ? payload : undefined ); }