Skip to main content
Glama

Create PrestaShop Cart Rule

ps_create_cart_rule

Create a PrestaShop discount voucher or coupon code with percentage or fixed amount reduction, set start/expiry dates, and define total and per-customer usage limits.

Instructions

Create a discount voucher/coupon code with a percentage or fixed amount reduction.

⚠️ Requires PS_READONLY=false and POST enabled on the PrestaShop Webservice key.

Args:

  • name: Internal name for the rule (required)

  • code: Voucher code customers enter (leave empty for auto-apply)

  • reduction_type: "percent" for percentage, "amount" for fixed amount

  • reduction_value: Reduction value (e.g., 10 for 10% or 10.00 for €10)

  • date_from: Start date (ISO format: YYYY-MM-DD HH:MM:SS)

  • date_to: Expiry date (ISO format: YYYY-MM-DD HH:MM:SS)

  • quantity: Total number of usages allowed (default: 1)

  • quantity_per_user: Max usages per customer (default: 1)

  • lang_id: Language ID for the name (default: "1")

Returns: Created cart rule ID and details.

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": {
      "name": "<name>",
      "reduction_type": "<reduction_type>",
      "reduction_value": "<reduction_value>",
      "date_from": "<date_from>",
      "date_to": "<date_to>"
    },
    "name": "ps_create_cart_rule"
  }
}

Input Schema

NameRequiredDescriptionDefault
codeNoVoucher code (empty = auto-apply)
nameYesInternal name for the rule
date_toYesExpiry date (YYYY-MM-DD or YYYY-MM-DD HH:MM:SS)
lang_idNoLanguage ID for the name1
quantityNoTotal usages allowed
date_fromYesStart date (YYYY-MM-DD or YYYY-MM-DD HH:MM:SS)
reduction_typeYesType of reduction
reduction_valueYesReduction value
quantity_per_userNoMax usages per customer
confirmation_tokenNoConfirmation token for destructive operations

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv3.1.0

TDQS

A3.9/5.0
Behavior4/5

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

Annotations already declare a non-read-only, non-destructive, non-idempotent write, and the description adds real context beyond them: the required webservice configuration and what the call returns (the new cart rule ID and details). It does not explain the side effects of the created rule (e.g., whether it applies to all customers by default) or the meaning of confirmation_token.

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 definition is front-loaded with the one-line purpose, then the critical configuration warning, then a scannable per-argument list with units and defaults. The Args block partially repeats the schema, but the examples justify the space and nothing is padded.

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 definition covers purpose, auth prerequisites, parameter meaning and the shape of the return value. The main remaining gaps are the undocumented confirmation_token and the default applicability of the created rule; both are minor relative to the coverage provided.

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?

With 100% schema coverage the baseline is 3, but the description earns more by explaining the two reduction_type modes, giving a concrete reduction_value example (10 = 10%, 10.00 = €10), and clarifying that an empty code means auto-apply. It omits confirmation_token entirely and narrows date_from/date_to to a datetime format while the schema also accepts a bare date.

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 gives a concrete verb and resource: create a discount voucher/cart rule with either a percentage or fixed-amount reduction. That is specific enough to separate it from read-oriented siblings such as ps_list_cart_rules and ps_get_cart, but it never names an alternative or states when to choose this over, e.g., ps_create_specific_price.

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 call prerequisites are stated explicitly (PS_READONLY=false and POST enabled on the webservice key), which is genuinely useful guidance for execution. However, there is no when-to-use vs when-not-to-use guidance and no reference to related tools like ps_list_cart_rules or ps_create_specific_price, so usage selection remains implied.

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