Skip to main content
Glama
@cmssy/mcp-server

@cmssy/mcp-server

Official

Create discount

create_discount

Create a discount code for percentage, fixed-amount, or free-shipping offers, with optional limits on minimum subtotal, total uses, and validity dates.

Instructions

Create a discount code. type is 'percentage' (value 0-100), 'fixed' (value in minor currency units, requires currency e.g. 'USD'; it applies only to carts in that currency), or 'free_shipping' (value 0). Optional limits: minSubtotal, maxUses, startsAt, endsAt. A cart is in its sales channel's currency; for a 'percentage' or 'free_shipping' code with a minimum, minSubtotal is the default-currency minimum and minSubtotalByCurrency the minimum in each additional currency.

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": {
      "code": "<code>",
      "type": "<type>",
      "value": "<value>"
    },
    "name": "create_discount"
  }
}

Input Schema

NameRequiredDescriptionDefault
codeYesThe discount code
typeYes
valueYesPercent (0-100), fixed amount in minor units, or 0
endsAtNoISO date-time the code expires
enabledNo
maxUsesNoTotal redemption cap
currencyNoISO 4217 code, required for 'fixed' type, omit otherwise
startsAtNoISO date-time the code becomes valid
minSubtotalNoMinimum cart subtotal in minor units: of the code's own currency for 'fixed', of the default currency otherwise. With minSubtotalByCurrency set, omitting it means the code does not apply to default-currency carts, and 0 means it applies to them with no minimum
minSubtotalByCurrencyNo'percentage' and 'free_shipping' only: minimum subtotal for carts in each additional currency, e.g. [{currency: 'EUR', amount: 5000}]. A code with any minimum applies only in the currencies its minimums name - nothing is converted

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed8 schema fields changedv0.73.2
    • addedInput schema / additionalProperties
      Added value: +false
    • removedInput schema / properties / currency / maxLength
      Removed value: -3
    • removedInput schema / properties / currency / minLength
      Removed value: -3
    • addedInput schema / properties / currency / pattern
      Added value: +"^[A-Z]{3}$"
    • removedInput schema / properties / enabled / default
      Removed value: -true
    • changedInput schema / properties / minSubtotal / description
      Previous value: -"Minimum order subtotal in minor units"New value: +"Minimum cart subtotal in minor units: of the code's own currency for 'fixed', of the default currency otherwise. With minSubtotalByCurrency set, omitting it means the code does not apply to default-currency carts, and 0 means it applies to them with no minimum"
    • addedInput schema / properties / minSubtotalByCurrency
      Added value: +{
      +  "description": "'percentage' and 'free_shipping' only: minimum subtotal for carts in each additional currency, e.g. [{currency: 'EUR', amount: 5000}]. A code with any minimum applies only in the currencies its minimums name - nothing is converted",
      +  "items": {
      +    "properties": {
      +      "amount": {
      +        "description": "Minor units of that currency",
      +        "maximum": 9007199254740991,
      +        "minimum": 0,
      +        "type": "integer"
      +      },
      +      "currency": {
      +        "description": "One of the workspace's additional currencies (update_cart_config additionalCurrencies)",
      +        "pattern": "^[A-Z]{3}$",
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "currency",
      +      "amount"
      +    ],
      +    "type": "object"
      +  },
      +  "maxItems": 9,
      +  "type": "array"
      +}
    • addedInput schema / required
      Added value: +[
      +  "code",
      +  "type",
      +  "value"
      +]
  2. First observedv0.73.1

TDQS

A3.8/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=false and destructiveHint=false, so safety is covered. Beyond that, the description discloses meaningful behavior: 'fixed' codes apply only to carts in the named currency, minimums are never converted, and a code with any minimum applies only in the currencies its minimums name. That is real scoping semantics an agent could not infer from annotations.

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

Conciseness4/5

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

It is front-loaded with the action and the type semantics before the optional limits. The final sentence about sales-channel currency is long and dense, but each clause carries distinct information about currency scoping that is not repeated elsewhere.

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?

For a 10-parameter creation tool with no output schema, the description covers the risky and confusing parts: type/value coupling, currency requirements, and minimum-subtotal semantics. It leaves `enabled` and the code length constraints to the schema, and says nothing about what is returned, which is a minor gap.

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 80%, so the baseline would be 3. The description earns above baseline by explaining what the enum values mean numerically (percentage 0-100, fixed in minor units, free_shipping 0) and by tying minSubtotal/minSubtotalByCurrency to the cart's sales-channel currency, which the schema does not explain.

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 opens with a specific verb and resource: 'Create a discount code.' It is unambiguous about the operation, and the type enumeration further scopes what is being created. It does not explicitly contrast itself with update_discount or set_discount_enabled, so the sibling distinction relies on the verb alone.

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?

Usage is implied by the verb 'Create' and the required fields, but there is no explicit when-to-use guidance or exclusion such as 'use update_discount to modify an existing code.' The type-specific constraints (fixed requires currency, free_shipping requires value 0) function as preconditions rather than tool-selection guidance.

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

Deploy Server

Other Tools