unlink_external_product
Disassociate an external product from a subscription product to correct billing records.
Instructions
Unlink an external product from a product. DELETE /products/{productId}/external-products/{externalProductId}.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| productId | Yes | Product ID (required) | |
| externalProductId | Yes | External product ID (required) |
Implementation Reference
- Handler function for unlink_external_product. Parses args with Zod schema, validates productId and externalProductId, then calls the service layer to DELETE the external product link.
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 { productId, externalProductId } = parsed.data; return handleToolCall(() => productService.unlinkExternalProduct(client, productId, externalProductId) ); } - Zod validation schema requiring productId and externalProductId (non-empty strings).
const schema = z.object({ productId: z.string().min(1, "productId is required"), externalProductId: z.string().min(1, "externalProductId is required"), }); - src/tools/products/index.ts:25-26 (registration)The tool is registered as part of the product tools array returned by registerProductTools().
unlinkExternalProductTool, ]; - Service helper that performs the DELETE /products/{productId}/external-products/{externalProductId} API call.
export async function unlinkExternalProduct( client: Client, productId: string, externalProductId: string ): Promise<unknown> { return client.delete<unknown>(`/products/${productId}/external-products/${externalProductId}`); }