Skip to main content
Glama

create_coupon

Idempotent

Create a percentage discount coupon for an app. WRITE, human-gated: a real create requires an elicitation-capable client (e.g. Claude Desktop). The human enters the final code, percent, expiry, visibility, and tier scope in a form; those values OVERRIDE the arguments here, which only pre-fill the form message as a proposal. Clients without elicitation are refused UNLESS the deployment sets SPARK_PAY_MCP_ALLOW_UNELICITED_WRITES=1 and the call passes confirm_write:true, which is how Claude Code and cron reach these writes; dry_run still works anywhere. Inserts a coupons row and best-effort-mints the matching Stripe coupon (checkout backfills it on first use if Stripe is unreachable). The code is uppercased and must be unique per app. By default the coupon applies to every paid tier. Set dry_run:true first to preview the exact row without writing. Cannot discount a free-only app. Three house rules are enforced and cannot be argued out of: every coupon expires within 6 months (omitting expires_at means the 6-month term, not a code that never expires); a coupon at 90%+ is created invite_only, so it is redeemable only by addresses added with invite_to_coupon; and a 90%+ coupon is pinned to the second-highest paid recurring tier and may never cover the top tier or a one-time (lifetime) plan. Use list_coupons afterwards to confirm, and list_plans to see an app's tier slugs.

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": {
      "app_id": "<app_id>",
      "code": "<code>",
      "discount_percent": "<discount_percent>"
    },
    "name": "create_coupon"
  }
}

Input Schema

NameRequiredDescriptionDefault
codeYes
app_idYes
listedNo
dry_runNo
max_usesNo
expires_atNo
descriptionNo
confirm_writeNo
applies_to_tiersNo
discount_percentYes
confirm_high_discountNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • addedInput schema / properties / confirm_write
      Added value: +{
      +  "default": false,
      +  "type": "boolean"
      +}
  2. First observed

TDQS

A4.4/5.0
Behavior5/5

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

Annotations only say readOnlyHint=false, idempotentHint=true, openWorldHint=true; the description adds far more: human-in-the-loop elicitation that overrides the arguments, the SPARK_PAY_MCP_ALLOW_UNELICITED_WRITES=1 + confirm_write escape hatch, Stripe minting as best-effort with checkout backfill on failure, code uppercasing and per-app uniqueness, and three non-negotiable business rules. Those are decisive behaviors an agent could not infer from the structured fields.

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?

Dense but front-loaded: purpose, then the write gate, then side effects, then house rules, then next steps. Nearly every clause carries operational weight, though the elicitation/override passage is packed into a single run-on stretch that would read better as short bullets.

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?

For a write tool with external side effects, no output schema, and 11 undocumented params, the description covers gating, failure modes (Stripe unreachable), irreversibility-adjacent constraints (free-only apps rejected, 6-month cap), and verification steps. The unexplained confirm_high_discount is the one small hole in an otherwise complete picture.

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 0% across 11 parameters, so the description carries the burden and does explain the highest-risk ones (dry_run, confirm_write, code, expires_at's 6-month default, discount_percent's 90%+ consequences, applies_to_tiers' all-paid-tier default and slug lookup via list_plans). However confirm_high_discount, listed, max_uses, description, and app_id receive no semantic explanation, leaving a meaningful gap for a mutation with this many knobs.

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?

Opens with a specific verb, resource, and scope: 'Create a percentage discount coupon for an app.' The percentage-only and single-app constraints distinguish it from bulk_create_coupon and from plan-mutation siblings without the agent needing to open another schema.

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 explicit workflow guidance ('Set dry_run:true first to preview', 'Use list_coupons afterwards to confirm, and list_plans to see an app's tier slugs') and clear preconditions for the elicitation gate and env-var fallback. It never names a sibling alternative for the multi-coupon case, so the create vs. bulk_create_coupon choice is left to inference.

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