Skip to main content
Glama
PaddleHQ

Paddle MCP Server

Official
by PaddleHQ

list_discounts

Read-only

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).
    `;
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations provide readOnlyHint=true, indicating safe read operations. The description adds valuable behavioral context beyond annotations: pagination mechanics ('use the after parameter with the last ID'), default behavior ('use maximum perPage by default'), data format ('amounts are in smallest currency unit'), and filtering capabilities. It doesn't mention rate limits or authentication needs, but adds significant operational details.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is efficiently structured with 5 sentences, each providing distinct value: purpose statement, default usage, filtering options, pagination instructions, and data format note. It's front-loaded with the core purpose and avoids redundancy. Every sentence earns its place without wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (7 parameters, pagination, filtering), annotations cover safety (readOnlyHint), and schema provides full parameter documentation. The description adds important operational context: pagination mechanics, default behavior, and data format. Without an output schema, it doesn't describe return values, but for a list operation with good schema coverage, this is reasonably complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so parameters are well-documented in the schema. The description adds some semantic context: it mentions filtering by 'code, id, status, and mode' (matching schema parameters) and explains pagination with 'after' and sorting with 'orderBy'. However, it doesn't provide additional meaning beyond what the schema already describes, such as parameter interactions or edge cases.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'list discounts in the account's catalog.' It specifies the verb ('list') and resource ('discounts'), but doesn't explicitly differentiate from sibling tools like 'get_discount' or 'list_discount_groups' beyond the name. The purpose is clear but lacks sibling comparison context.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides implied usage guidance: 'Use the maximum perPage by default (200) to ensure comprehensive results' suggests a best practice, and mentions filtering, pagination, and sorting. However, it doesn't explicitly state when to use this tool versus alternatives like 'get_discount' (for single discounts) or 'list_discount_groups', nor does it mention prerequisites or exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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