Skip to main content
Glama

create_coupon

Create a coupon for Checkout Page.

Use this when a merchant wants a discount code that customers can enter on eligible pages.

Where and what a coupon discounts:

  • rules lists where the coupon works and what it discounts: [{ pageId, appliesTo, priceIds, ticketTypeIds, bumpProductIds }]. Omit it (or send an empty list) for a coupon that discounts the whole order on every checkout page and event.

  • A coupon works on any page a rule names. Several rules on one page are combined with OR. An event can't mix tickets and ticketsAndAddOns rules.

  • Checkout pages: wholeOrder (the main product at any price and every order bump), prices (applies when the customer buys one of priceIds, discounting that price only), pricesAndBumps (applies only when the customer buys one of priceIds AND one of bumpProductIds, discounting both).

  • Events: wholeOrder (every ticket and add-on), tickets (applies when the customer buys one of ticketTypeIds, discounting those tickets only), ticketsAndAddOns (applies only when the customer buys one of ticketTypeIds AND one of bumpProductIds, discounting both).

  • priceIds are the ids of the page's main product's prices (from get_product), not Stripe price ids. bumpProductIds are products of order bumps or add-ons on that page. Leave priceIds, ticketTypeIds or bumpProductIds empty for every price, ticket type, bump or add-on on the page, including ones added later. A page with no bumps or add-ons cannot use pricesAndBumps or ticketsAndAddOns.

  • When no rule matches the order, the code is accepted but discounts nothing. Setup fees and ticket fees join with appliesToSetupFee and appliesToTicketFees.

  • pageIds and ticketTypeIds are deprecated: use rules. They are still accepted without rules (each page whole order, or tickets on an event with picked ticket types).

How discount types work:

  • amountOff is a fixed amount discount. It requires currency. It comes off once per order, shared equally across the lines the coupon applies to (on a subscription it stays on the main recurring line).

  • percentOff is a percentage discount applied to the eligible checkout total.

  • Set exactly one of amountOff or percentOff, never both.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "label": "<label>",
      "code": "<code>",
      "duration": "<duration>"
    },
    "name": "create_coupon"
  }
}

Input Schema

NameRequiredDescriptionDefault
codeYesThe coupon code a customer enters.
labelYesInternal name for the coupon.
rulesNoWhere the coupon works and what it discounts, one rule per page. A coupon works on a page when any of its rules names that page, and on each page the rules are combined with OR (an event cannot mix `tickets` and `ticketsAndAddOns` rules). Omit `rules` (and `pageIds`), or send an empty list, for a coupon that discounts the whole order on every checkout page and event.
pageIdsNoDeprecated: use `rules`. The checkout pages and events this coupon can be used on, each discounting the whole order. Accepted only without `rules`. In responses, the pages named by `rules`.
currencyNoThree-letter ISO code for the currency of the amountOff parameter. Required when `amountOff` is set, and not allowed when `percentOff` is set.
durationYesHow long the discount lasts: `once` applies to the first eligible payment, `repeating` applies for a fixed number of months, and `forever` applies until canceled or expired.
redeemByNoThe ISO datetime that this coupon must be used before.
amountOffNoA positive integer representing the amount to subtract from an invoice total, in the smallest currency unit of `currency` (for example `500` USD is $5.00 and `500` JPY is ¥500). Required if `percentOff` is not passed.
percentOffNoA positive float larger than 0, and smaller or equal to 100, that represents the discount the coupon will apply (required if `amountOff` is not passed).
ticketTypeIdsNoDeprecated: use `rules`. Ticket types of events in `pageIds`: on such an event the coupon discounts only those tickets. Accepted only without `rules`. In responses, every ticket type named by `rules`.
maxRedemptionsNoThe total number of times this coupon can be redeemed across all customers. Doesn't limit a single customer from redeeming multiple times. Omit for unlimited redemptions.
durationInMonthsNoA positive integer representing the number of months the coupon applies for. Required when `duration === repeating`, and not allowed when `duration` is `once` or `forever`.
appliesToSetupFeeNoWhen enabled, applies this coupon discount to the setup fee.
appliesToTicketFeesNoWhen enabled, applies this coupon discount to ticket-level fees on event pages as well as the ticket prices. Defaults to false, which leaves ticket fees undiscounted.

Output Schema

NameRequiredDescriptionDefault
dataYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed10 schema fields changed
    • addedInput schema / properties / pageIds / deprecated
      Added value: +true
    • changedInput schema / properties / pageIds / description
      Previous value: -"A list of pageIds that this coupon can be used within."New value: +"Deprecated: use `rules`. The checkout pages and events this coupon can be used on, each discounting the whole order. Accepted only without `rules`. In responses, the pages named by `rules`."
    • addedInput schema / properties / rules
      Added value: +{
      +  "description": "Where the coupon works and what it discounts, one rule per page. A coupon works on a page when any of its rules names that page, and on each page the rules are combined with OR (an event cannot mix `tickets` and `ticketsAndAddOns` rules). Omit `rules` (and `pageIds`), or send an empty list, for a coupon that discounts the whole order on every checkout page and event.",
      +  "example": [
      +    {
      +      "appliesTo": "pricesAndBumps",
      +      "bumpProductIds": [],
      +      "pageId": "67ee075004de439ab0b675b6",
      +      "priceIds": [
      +        "67fcbdac6a91c25ef2d3534a"
      +      ]
      +    }
      +  ],
      +  "items": {
      +    "properties": {
      +      "appliesTo": {
      +        "description": "What the coupon discounts on the page. Checkout pages: `wholeOrder` (the main product at any price and every order bump), `prices` (applies when the customer buys one of `priceIds`, discounting that price only), `pricesAndBumps` (applies only when the customer buys one of `priceIds` and one of `bumpProductIds`, discounting both). Events: `wholeOrder` (every ticket and add-on), `tickets` (applies when the customer buys one of `ticketTypeIds`, discounting those tickets only), `ticketsAndAddOns` (applies only when the customer buys one of `ticketTypeIds` and one of `bumpProductIds`, discounting both). Setup fees and ticket fees follow `appliesToSetupFee` and `appliesToTicketFees`.",
      +        "enum": [
      +          "wholeOrder",
      +          "prices",
      +          "pricesAndBumps",
      +          "tickets",
      +          "ticketsAndAddOns"
      +        ],
      +        "example": "prices",
      +        "type": "string"
      +      },
      +      "bumpProductIds": {
      +        "description": "Products of order bumps (checkout pages) or add-ons (events) on the page, only for `pricesAndBumps` and `ticketsAndAddOns`. An empty list or no list means every bump or add-on on the page, including ones added later; the coupon still needs one of them bought.",
      +        "items": {
      +          "pattern": "^[0-9a-fA-F]{24}$",
      +          "type": "string"
      +        },
      +        "type": "array"
      +      },
      +      "pageId": {
      +        "description": "The checkout page or event this rule applies to.",
      +        "pattern": "^[0-9a-fA-F]{24}$",
      +        "type": "string"
      +      },
      +      "priceIds": {
      +        "description": "Prices of the page's main product, only for `prices` and `pricesAndBumps`. An empty list or no list means every price of the main product, including prices added later. These are the `id`s of a product's `prices`, not Stripe price ids.",
      +        "example": [
      +          "67fcbdac6a91c25ef2d3534a"
      +        ],
      +        "items": {
      +          "pattern": "^[0-9a-fA-F]{24}$",
      +          "type": "string"
      +        },
      +        "type": "array"
      +      },
      +      "ticketTypeIds": {
      +        "description": "Ticket types of the event, only for `tickets` and `ticketsAndAddOns`. An empty list or no list means every ticket type of the event, including ticket types added later.",
      +        "items": {
      +          "pattern": "^[0-9a-fA-F]{24}$",
      +          "type": "string"
      +        },
      +        "type": "array"
      +      }
      +    },
      +    "required": [
      +      "pageId",
      +      "appliesTo"
      +    ],
      +    "type": "object"
      +  },
      +  "type": "array"
      +}
    • addedInput schema / properties / ticketTypeIds / deprecated
      Added value: +true
    • changedInput schema / properties / ticketTypeIds / description
      Previous value: -"List of ticket type IDs that this coupon can be used with. Ticket ticket ids must belong to a page specified in the `pageIds` array."New value: +"Deprecated: use `rules`. Ticket types of events in `pageIds`: on such an event the coupon discounts only those tickets. Accepted only without `rules`. In responses, every ticket type named by `rules`."
    • addedOutput schema / properties / data / properties / pageIds / deprecated
      Added value: +true
    • addedOutput schema / properties / data / properties / pageIds / description
      Added value: +"Deprecated: use `rules`. The checkout pages and events this coupon can be used on, each discounting the whole order. Accepted only without `rules`. In responses, the pages named by `rules`."
    • addedOutput schema / properties / data / properties / rules
      Added value: +{
      +  "description": "Where the coupon works and what it discounts, one rule per page. A coupon works on a page when any of its rules names that page, and on each page the rules are combined with OR (an event cannot mix `tickets` and `ticketsAndAddOns` rules). Omit `rules` (and `pageIds`), or send an empty list, for a coupon that discounts the whole order on every checkout page and event.",
      +  "items": {
      +    "additionalProperties": false,
      +    "properties": {
      +      "appliesTo": {
      +        "description": "What the coupon discounts on the page. Checkout pages: `wholeOrder` (the main product at any price and every order bump), `prices` (applies when the customer buys one of `priceIds`, discounting that price only), `pricesAndBumps` (applies only when the customer buys one of `priceIds` and one of `bumpProductIds`, discounting both). Events: `wholeOrder` (every ticket and add-on), `tickets` (applies when the customer buys one of `ticketTypeIds`, discounting those tickets only), `ticketsAndAddOns` (applies only when the customer buys one of `ticketTypeIds` and one of `bumpProductIds`, discounting both). Setup fees and ticket fees follow `appliesToSetupFee` and `appliesToTicketFees`.",
      +        "enum": [
      +          "wholeOrder",
      +          "prices",
      +          "pricesAndBumps",
      +          "tickets",
      +          "ticketsAndAddOns"
      +        ],
      +        "example": "prices",
      +        "type": "string"
      +      },
      +      "bumpProductIds": {
      +        "description": "Products of order bumps (checkout pages) or add-ons (events) on the page, only for `pricesAndBumps` and `ticketsAndAddOns`. An empty list or no list means every bump or add-on on the page, including ones added later; the coupon still needs one of them bought.",
      +        "items": {
      +          "type": "string"
      +        },
      +        "type": "array"
      +      },
      +      "pageId": {
      +        "description": "The checkout page or event this rule applies to.",
      +        "type": "string"
      +      },
      +      "priceIds": {
      +        "description": "Prices of the page's main product, only for `prices` and `pricesAndBumps`. An empty list or no list means every price of the main product, including prices added later. These are the `id`s of a product's `prices`, not Stripe price ids.",
      +        "items": {
      +          "type": "string"
      +        },
      +        "type": "array"
      +      },
      +      "ticketTypeIds": {
      +        "description": "Ticket types of the event, only for `tickets` and `ticketsAndAddOns`. An empty list or no list means every ticket type of the event, including ticket types added later.",
      +        "items": {
      +          "type": "string"
      +        },
      +        "type": "array"
      +      }
      +    },
      +    "required": [
      +      "pageId",
      +      "appliesTo",
      +      "priceIds",
      +      "ticketTypeIds",
      +      "bumpProductIds"
      +    ],
      +    "type": "object"
      +  },
      +  "type": "array"
      +}
    • addedOutput schema / properties / data / properties / ticketTypeIds / deprecated
      Added value: +true
    • changedOutput schema / properties / data / properties / ticketTypeIds / description
      Previous value: -"List of ticket type IDs that this coupon can be used with."New value: +"Deprecated: use `rules`. Ticket types of events in `pageIds`: on such an event the coupon discounts only those tickets. Accepted only without `rules`. In responses, every ticket type named by `rules`."
  2. Changed1 schema field changed
    • changedInput schema / properties / amountOff / description
      Previous value: -"A positive integer representing the amount to subtract from an invoice total (required if `percentOff` is not passed)."New value: +"A positive integer representing the amount to subtract from an invoice total, in the smallest currency unit of `currency` (for example `500` USD is $5.00 and `500` JPY is ¥500). Required if `percentOff` is not passed."
  3. First observed

TDQS

A4.5/5.0
Behavior5/5

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

Annotations only declare a non-read-only, non-destructive write, so the description must supply behavioral context — and it does: no matching rule means the code is accepted but discounts nothing, several rules on a page combine with OR, events cannot mix tickets and ticketsAndAddOns, and deprecated pageIds/ticketTypeIds are still accepted only without rules. That is genuine edge-case behavior an agent could not infer from annotations or schema.

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

Conciseness3/5

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

The purpose and usage are front-loaded and the bold section headers aid scanning, but the middle bullet enumerating wholeOrder/prices/pricesAndBumps/tickets/ticketsAndAddOns reproduces the appliesTo enum description almost verbatim from the schema, adding length without new information. Roughly a third of the text is duplication of structured data.

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

Completeness5/5

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

An output schema exists so return values needn't be described, annotations cover the safety profile, and the description covers the one genuinely hard part of this 14-parameter tool: how rules map pages, targets, and price/ticket/bump ids to actual discount behavior, including the empty-list and no-match cases.

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

Parameters4/5

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

Schema coverage is already 100%, so the schema carries the field documentation, but the description adds real semantics: exactly one of amountOff/percentOff, amountOff is shared equally across eligible lines and requires currency, and priceIds are the page product's price ids rather than Stripe ids. Some of this merely mirrors the schema's own prose, which keeps it from a 5.

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

Purpose5/5

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

States a specific verb and resource ('Create a coupon for Checkout Page') and immediately scopes it to the merchant creating a customer-entered discount code. It is unmistakable against siblings like list_coupons, update_coupon, and create_checkout_page, which are distinct resources or operations.

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

Usage Guidelines4/5

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

Gives a clear triggering condition: 'Use this when a merchant wants a discount code that customers can enter on eligible pages.' It does not, however, name the alternative (update_coupon) for modifying an existing coupon, nor state when not to use this tool.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources