get_customer_address
Retrieve a single address book entry for a customer using customer ID and address ID.
Instructions
Get a single address book entry by ID. GET /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 executes the tool logic: parses the Zod-validated arguments (customerId, addressId) and delegates to customerServices.getCustomerAddress().
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.getCustomerAddress(client, customerId, addressId)); } - Zod schema validating that customerId and addressId are non-empty strings.
const schema = z.object({ customerId: z.string().min(1, "customerId is required"), addressId: z.string().min(1, "addressId is required"), }); - src/tools/customers/index.ts:31-56 (registration)Registration of getCustomerAddressTool in the customer tools array returned by registerCustomerTools().
export function registerCustomerTools(): Tool[] { return [ listCustomersTool, getCustomerTool, createCustomerTool, updateCustomerTool, deleteCustomerTool, getCustomerInvoicesTool, getCustomerUnpaidInvoicesTool, getCustomerSubscriptionsTool, getCustomerLogsTool, listCustomerAddressesTool, getCustomerAddressTool, createCustomerAddressTool, updateCustomerAddressTool, deleteCustomerAddressTool, listCustomerPaymentMethodsTool, getCustomerPaymentMethodTool, createCustomerPaymentMethodTool, updateCustomerPaymentMethodTool, deleteCustomerPaymentMethodTool, listCustomerChargesCreditsTool, createCustomerChargeCreditTool, deleteCustomerChargeCreditTool, ]; } - Service function that performs the actual HTTP GET request to /customers/{customerId}/addressbooks/{addressId}.
export async function getCustomerAddress( client: Client, customerId: string, addressId: string ): Promise<CustomerAddressBook> { return client.get<CustomerAddressBook>( `/customers/${customerId}/addressbooks/${addressId}` ); } - MCP tool definition including name 'get_customer_address', description, and JSON Schema input schema.
const definition = { name: "get_customer_address", description: "Get a single address book entry by ID. GET /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"], }, };