Skip to main content
Glama

create_coupon_promotion

Create a coupon for an existing promotion in LearnWorlds by providing the promotion ID and coupon details like code, expiration, and quantity.

Instructions

🟡 WRITE · creates data · POST /v2/promotions/{pid}/coupons

Creates a coupon for the promotion specified by the provided promotion id. The endpoint response is the created coupon resource.

Behavior: creates a record or triggers an action in the live school. Not idempotent: a repeated call can duplicate the effect. Auth (admin API token + Lw-Client id) is injected server-side, never by the model; calls are throttled to stay under LearnWorlds' 30-per-10s cap and retried on 429/5xx. Parameters: the whole JSON payload goes in the single body argument, forwarded verbatim (the spec leaves body optional, but this endpoint expects one). Returns: HTTP <status> followed by the LearnWorlds JSON response body. A non-2xx reply surfaces as a tool error with that status and the API error payload — 401 bad/expired token, 403 not permitted, 404 no such record, 422 rejected input. Use when: only when the user asked to create this. Check with a 🟢 read tool that the target exists and the record is not already there. Related Promotions tools: get_coupon_usage, get_promotions_coupons, create_coupons_promotion_bulk, create_promotion, get_promotion.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pidYesPromotion Id
bodyNo

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. First observedv1.0.0

TDQS

A4.4/5.0
Behavior5/5

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

The description goes well beyond the annotations by disclosing that calls affect the live school, are not idempotent, have server-side auth, are throttled at 30-per-10s, and retried on 429/5xx. It also explains the exact return format and error status meanings. This fully informs the agent of side effects and operational constraints.

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 long but tightly organized with labeled sections: Behavior, Parameters, Returns, Use when, and Related tools. Every section provides actionable information, and the most important facts—write operation, endpoint, idempotency—are front-loaded. No content feels redundant or filler.

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?

With no output schema, the description compensates by specifying the response format, error behavior, auth requirements, rate limits, and preconditions. It also names related Promotions tools for navigation. For a mutating tool with side effects, this is a thorough and complete definition.

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?

The schema covers pid and nested body fields, but the description adds critical meaning by explaining that the whole JSON payload goes into the single `body` argument and is forwarded verbatim, despite the schema marking it optional. This resolves a real ambiguity. It does not elaborate on the example's `prefix` field, but the core parameter behavior is well explained.

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 action: 'Creates a coupon for the promotion specified by the provided promotion id,' and reinforces it with the HTTP endpoint. It is specific about the resource and operation. However, it only lists related sibling tools like create_coupons_promotion_bulk without explicitly explaining how this tool differs from them.

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?

The description includes a dedicated 'Use when' section: 'only when the user asked to create this' and advises checking with a read tool that the target exists and the record is not already there. This gives clear precondition guidance. It does not explicitly contrast with the bulk creation sibling, so the reader must infer when to choose one over the other.

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/ohneben/Learnworlds-MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server