get_discount
Retrieve discount details from Paddle Billing using a discount ID to verify pricing, apply promotions, or manage offers.
Instructions
This tool will retrieve a discount from Paddle by its ID.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| discountId | Yes | Paddle ID of the discount. |
Implementation Reference
- src/functions.ts:740-749 (handler)The main handler function for the 'get_discount' tool. It takes a discountId and optional query parameters, calls the Paddle SDK's paddle.discounts.get method, and returns the discount object or error.export const getDiscount = async (paddle: Paddle, params: z.infer<typeof Parameters.getDiscountParameters>) => { try { const { discountId, ...queryParams } = params; const hasQueryParams = Object.keys(queryParams).length > 0; const discount = await paddle.discounts.get(discountId, hasQueryParams ? queryParams : undefined); return discount; } catch (error) { return error; } };
- src/tools.ts:142-153 (registration)Tool definition and registration in the tools array, specifying the method name 'get_discount', description, Zod parameters schema, and required permissions (read/get on discounts).{ method: "get_discount", name: "Get a discount", description: prompts.getDiscountPrompt, parameters: params.getDiscountParameters, actions: { discounts: { read: true, get: true, }, }, },
- src/prompts.ts:1125-1127 (schema)Prompt/description for the get_discount tool, used in tool registration.export const getDiscountPrompt = ` This tool will retrieve a discount from Paddle by its ID. `;
- src/api.ts:68-68 (registration)Maps the TOOL_METHODS.GET_DISCOUNT constant ('get_discount') to the getDiscount handler function in the toolMap used by PaddleAPI.[TOOL_METHODS.GET_DISCOUNT]: funcs.getDiscount,
- src/constants.ts:60-60 (registration)Constant definition mapping GET_DISCOUNT to the tool method string 'get_discount', used in toolMap and elsewhere.GET_DISCOUNT: "get_discount",