delete_product_rate_plan_charge
Delete a specific rate plan charge from your product catalog by providing its charge ID. This action permanently removes the charge.
Instructions
Delete a rate plan charge. DELETE /product-rateplan-charges/{chargeId}.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| chargeId | Yes | Rate plan charge ID |
Implementation Reference
- Handler function that validates args with Zod schema and calls the service to delete a rate plan charge.
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(() => chargeService.deleteRatePlanCharge(client, parsed.data.chargeId)); } export const deleteRatePlanChargeTool: Tool = { definition, handler, }; - Zod schema and inputSchema for the delete_product_rate_plan_charge tool, requiring a chargeId string.
const schema = z.object({ chargeId: z.string().min(1, "chargeId is required"), }); - src/tools/product_rate_plan_charges/index.ts:13-27 (registration)Registration function that returns an array of all product rate plan charge tools, including deleteRatePlanChargeTool.
export function registerProductRatePlanChargeTools(): Tool[] { return [ listRatePlanChargesTool, getRatePlanChargeTool, createRatePlanChargeTool, updateRatePlanChargeTool, deleteRatePlanChargeTool, ]; } export { listRatePlanChargesTool } from "./listRatePlanCharges.js"; export { getRatePlanChargeTool } from "./getRatePlanCharge.js"; export { createRatePlanChargeTool } from "./createRatePlanCharge.js"; export { updateRatePlanChargeTool } from "./updateRatePlanCharge.js"; export { deleteRatePlanChargeTool } from "./deleteRatePlanCharge.js"; - Service function that performs the actual DELETE /product-rateplan-charges/{chargeId} API call.
export async function deleteRatePlanCharge( client: Client, chargeId: string ): Promise<Record<string, unknown>> { const result = await client.delete<Record<string, unknown>>( `/product-rateplan-charges/${chargeId}` ); return Object.keys(result ?? {}).length ? result : { success: true, message: "Rate plan charge deleted" }; }