Skip to main content
Glama
PaddleHQ
by PaddleHQ

list_discounts

Retrieve and filter discount information from your Paddle account catalog. View active or archived discounts, search by code or ID, and manage paginated results for comprehensive catalog management.

Instructions

This tool will list discounts in the account's catalog.

Use the maximum perPage by default (200) to ensure comprehensive results. Filter discounts by code, id, status, and mode as needed. Results are paginated - use the 'after' parameter with the last ID from previous results to get the next page. Sort and order results using the orderBy parameter.

Amounts are in the smallest currency unit (e.g., cents).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
afterNoReturn entities after the specified Paddle ID when working with paginated endpoints.
codeNoReturn entities that match the discount code. Use a comma-separated list to specify multiple discount codes.
idNoReturn only the IDs specified. Use a comma-separated list to get multiple entities.
orderByNoOrder returned entities by the specified field and direction.
perPageNoSet how many entities are returned per page. Returns the maximum number of results if a number greater than the maximum is requested.
statusNoReturn entities that match the specified status. Use a comma-separated list to specify multiple status values.
modeNoReturn entities that match the specified mode.

Implementation Reference

  • The core handler function that executes the list_discounts tool. It lists discounts using the Paddle SDK's discounts.list method, retrieves the first page of results, computes pagination metadata using the shared paginationData helper, and returns the discounts with pagination info or the error if one occurs.
    export const listDiscounts = async (paddle: Paddle, params: z.infer<typeof Parameters.listDiscountsParameters>) => { try { const collection = paddle.discounts.list(params); const discounts = await collection.next(); const pagination = paginationData(collection); return { pagination, discounts }; } catch (error) { return error; } };
  • src/tools.ts:118-129 (registration)
    Primary tool registration in the tools array. Defines the tool's method name, human-readable name, description prompt, Zod input schema reference, and required permissions/actions for discounts (read and list).
    { method: "list_discounts", name: "List discounts", description: prompts.listDiscountsPrompt, parameters: params.listDiscountsParameters, actions: { discounts: { read: true, list: true, }, }, },
  • src/api.ts:9-93 (registration)
    Maps the LIST_DISCOUNTS constant to the listDiscounts handler function in the PaddleAPI class's toolMap. This enables routing tool calls to the correct handler during API execution.
    const toolMap: Record<ToolMethod, ToolFunction> = { [TOOL_METHODS.LIST_PRODUCTS]: funcs.listProducts, [TOOL_METHODS.CREATE_PRODUCT]: funcs.createProduct, [TOOL_METHODS.GET_PRODUCT]: funcs.getProduct, [TOOL_METHODS.UPDATE_PRODUCT]: funcs.updateProduct, [TOOL_METHODS.LIST_PRICES]: funcs.listPrices, [TOOL_METHODS.CREATE_PRICE]: funcs.createPrice, [TOOL_METHODS.GET_PRICE]: funcs.getPrice, [TOOL_METHODS.UPDATE_PRICE]: funcs.updatePrice, [TOOL_METHODS.LIST_TRANSACTIONS]: funcs.listTransactions, [TOOL_METHODS.CREATE_TRANSACTION]: funcs.createTransaction, [TOOL_METHODS.PREVIEW_PRICES]: funcs.previewPrices, [TOOL_METHODS.PREVIEW_TRANSACTION_CREATE]: funcs.previewTransactionCreate, [TOOL_METHODS.GET_TRANSACTION]: funcs.getTransaction, [TOOL_METHODS.UPDATE_TRANSACTION]: funcs.updateTransaction, [TOOL_METHODS.REVISE_TRANSACTION]: funcs.reviseTransaction, [TOOL_METHODS.LIST_ADJUSTMENTS]: funcs.listAdjustments, [TOOL_METHODS.CREATE_ADJUSTMENT]: funcs.createAdjustment, [TOOL_METHODS.GET_ADJUSTMENT_CREDIT_NOTE]: funcs.getAdjustmentCreditNote, [TOOL_METHODS.LIST_CREDIT_BALANCES]: funcs.listCreditBalances, [TOOL_METHODS.LIST_CUSTOMERS]: funcs.listCustomers, [TOOL_METHODS.CREATE_CUSTOMER]: funcs.createCustomer, [TOOL_METHODS.GET_CUSTOMER]: funcs.getCustomer, [TOOL_METHODS.UPDATE_CUSTOMER]: funcs.updateCustomer, [TOOL_METHODS.LIST_ADDRESSES]: funcs.listAddresses, [TOOL_METHODS.CREATE_ADDRESS]: funcs.createAddress, [TOOL_METHODS.GET_ADDRESS]: funcs.getAddress, [TOOL_METHODS.UPDATE_ADDRESS]: funcs.updateAddress, [TOOL_METHODS.LIST_BUSINESSES]: funcs.listBusinesses, [TOOL_METHODS.CREATE_BUSINESS]: funcs.createBusiness, [TOOL_METHODS.GET_BUSINESS]: funcs.getBusiness, [TOOL_METHODS.UPDATE_BUSINESS]: funcs.updateBusiness, [TOOL_METHODS.LIST_SAVED_PAYMENT_METHODS]: funcs.listSavedPaymentMethods, [TOOL_METHODS.GET_SAVED_PAYMENT_METHOD]: funcs.getSavedPaymentMethod, [TOOL_METHODS.DELETE_SAVED_PAYMENT_METHOD]: funcs.deleteSavedPaymentMethod, [TOOL_METHODS.CREATE_CUSTOMER_PORTAL_SESSION]: funcs.createCustomerPortalSession, [TOOL_METHODS.LIST_NOTIFICATION_SETTINGS]: funcs.listNotificationSettings, [TOOL_METHODS.CREATE_NOTIFICATION_SETTING]: funcs.createNotificationSetting, [TOOL_METHODS.GET_NOTIFICATION_SETTING]: funcs.getNotificationSetting, [TOOL_METHODS.UPDATE_NOTIFICATION_SETTING]: funcs.updateNotificationSetting, [TOOL_METHODS.DELETE_NOTIFICATION_SETTING]: funcs.deleteNotificationSetting, [TOOL_METHODS.LIST_EVENTS]: funcs.listEvents, [TOOL_METHODS.LIST_NOTIFICATIONS]: funcs.listNotifications, [TOOL_METHODS.GET_NOTIFICATION]: funcs.getNotification, [TOOL_METHODS.LIST_NOTIFICATION_LOGS]: funcs.listNotificationLogs, [TOOL_METHODS.REPLAY_NOTIFICATION]: funcs.replayNotification, [TOOL_METHODS.LIST_SIMULATIONS]: funcs.listSimulations, [TOOL_METHODS.CREATE_SIMULATION]: funcs.createSimulation, [TOOL_METHODS.GET_SIMULATION]: funcs.getSimulation, [TOOL_METHODS.UPDATE_SIMULATION]: funcs.updateSimulation, [TOOL_METHODS.LIST_SIMULATION_RUNS]: funcs.listSimulationRuns, [TOOL_METHODS.CREATE_SIMULATION_RUN]: funcs.createSimulationRun, [TOOL_METHODS.GET_SIMULATION_RUN]: funcs.getSimulationRun, [TOOL_METHODS.LIST_SIMULATION_RUN_EVENTS]: funcs.listSimulationRunEvents, [TOOL_METHODS.GET_SIMULATION_RUN_EVENT]: funcs.getSimulationRunEvent, [TOOL_METHODS.REPLAY_SIMULATION_RUN_EVENT]: funcs.replaySimulationRunEvent, [TOOL_METHODS.GET_TRANSACTION_INVOICE]: funcs.getTransactionInvoice, [TOOL_METHODS.LIST_DISCOUNTS]: funcs.listDiscounts, [TOOL_METHODS.CREATE_DISCOUNT]: funcs.createDiscount, [TOOL_METHODS.GET_DISCOUNT]: funcs.getDiscount, [TOOL_METHODS.UPDATE_DISCOUNT]: funcs.updateDiscount, [TOOL_METHODS.LIST_DISCOUNT_GROUPS]: funcs.listDiscountGroups, [TOOL_METHODS.CREATE_DISCOUNT_GROUP]: funcs.createDiscountGroup, [TOOL_METHODS.GET_DISCOUNT_GROUP]: funcs.getDiscountGroup, [TOOL_METHODS.UPDATE_DISCOUNT_GROUP]: funcs.updateDiscountGroup, [TOOL_METHODS.ARCHIVE_DISCOUNT_GROUP]: funcs.archiveDiscountGroup, [TOOL_METHODS.GET_SUBSCRIPTION]: funcs.getSubscription, [TOOL_METHODS.UPDATE_SUBSCRIPTION]: funcs.updateSubscription, [TOOL_METHODS.LIST_SUBSCRIPTIONS]: funcs.listSubscriptions, [TOOL_METHODS.CANCEL_SUBSCRIPTION]: funcs.cancelSubscription, [TOOL_METHODS.PAUSE_SUBSCRIPTION]: funcs.pauseSubscription, [TOOL_METHODS.RESUME_SUBSCRIPTION]: funcs.resumeSubscription, [TOOL_METHODS.ACTIVATE_SUBSCRIPTION]: funcs.activateSubscription, [TOOL_METHODS.PREVIEW_SUBSCRIPTION_UPDATE]: funcs.previewSubscriptionUpdate, [TOOL_METHODS.CREATE_SUBSCRIPTION_CHARGE]: funcs.createSubscriptionCharge, [TOOL_METHODS.PREVIEW_SUBSCRIPTION_CHARGE]: funcs.previewSubscriptionCharge, [TOOL_METHODS.LIST_REPORTS]: funcs.listReports, [TOOL_METHODS.CREATE_REPORT]: funcs.createReport, [TOOL_METHODS.GET_REPORT]: funcs.getReport, [TOOL_METHODS.GET_REPORT_CSV]: funcs.getReportCsv, [TOOL_METHODS.LIST_CLIENT_SIDE_TOKENS]: funcs.listClientSideTokens, [TOOL_METHODS.CREATE_CLIENT_SIDE_TOKEN]: funcs.createClientSideToken, [TOOL_METHODS.GET_CLIENT_SIDE_TOKEN]: funcs.getClientSideToken, [TOOL_METHODS.REVOKE_CLIENT_SIDE_TOKEN]: funcs.revokeClientSideToken, };
  • Constant definition for the tool method string 'list_discounts' used in registrations and mappings.
    LIST_DISCOUNTS: "list_discounts",
  • Prompt string providing guidance and documentation for using the list_discounts tool, referenced in the tool registration.
    export const listDiscountsPrompt = ` This tool will list discounts in the account's catalog. Use the maximum perPage by default (200) to ensure comprehensive results. Filter discounts by code, id, status, and mode as needed. Results are paginated - use the 'after' parameter with the last ID from previous results to get the next page. Sort and order results using the orderBy parameter. Amounts are in the smallest currency unit (e.g., cents). `;

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