Skip to main content
Glama
PaddleHQ

Paddle MCP Server

Official
by PaddleHQ

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
NameRequiredDescriptionDefault
discountIdYesPaddle ID of the discount.

Implementation Reference

  • 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,
        },
      },
    },
  • 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",

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/PaddleHQ/paddle-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server