Skip to main content
Glama

cart.applyDiscount

Idempotent

Apply a discount or coupon code to a droplinked cart. Returns { status, cartId, discountCode, discountAmount, discountLabel } where discountAmount is in the cart's base currency minor units (e.g. cents). Call this after cart.addLine and before start_checkout / process_payment. Surfaces structured error reasons (CART_NOT_FOUND / INVALID_DISCOUNT_CODE / DISCOUNT_EXPIRED / DISCOUNT_NOT_APPLICABLE / BACKEND_BAD_REQUEST / BACKEND_UNAVAILABLE) so the orchestrating agent can retry with a different code or proceed without a discount.

AUTH: not on the public read tier — calling this without a valid X-MCP-API-Key returns JSON-RPC error -32001 with data.code=MCP_API_KEY_REQUIRED and never reaches the tool. Request a key from ops@droplinked.com. Discovery, catalogue and trust-fabric reads need no credential.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cartIdYes
discountCodeYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.3/5.0
Behavior4/5

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

Annotations already establish the tool as non-read-only, idempotent, and non-destructive. The description adds substantial context beyond these: the return shape including minor-unit discountAmount, the auth requirement (not on public read tier, specific error code MCP_API_KEY_REQUIRED), and the full set of structured error reasons. This goes well beyond the annotations without contradicting them.

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?

The description is long (two paragraphs) but every sentence provides actionable information: purpose, return type, workflow position, error handling, and auth. It is front-loaded with the purpose and outcome. The auth paragraph could be seen as auxiliary, but it is critical for correct invocation. Overall it is dense and structured, though slightly verbose.

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 an operation with no output schema, the description covers return structure, error codes, workflow placement, and auth. It does not describe side effects beyond 'apply' or whether the cart is permanently modified, but the idempotentHint and error handling suggest retry safety. Given the tool's complexity and lack of structured output, this is very complete.

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%, so the description must compensate. It clarifies that discountCode is a 'coupon code' and that discountAmount comes back in minor units, but it does not explicitly define cartId (though it is implicitly the droplinked cart from addLine) or give syntax/format details for either parameter. The description adds some meaning but not exhaustive parameter semantics.

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?

The description opens with a specific verb and resource: 'Apply a discount or coupon code to a droplinked cart.' It clearly distinguishes this tool from siblings because no other tool in the list handles discount application, and it names the workflow context (after addLine, before checkout/payment). The purpose is unambiguous and differentiated.

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

Usage Guidelines5/5

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

Explicitly states the positional ordering: 'Call this after cart.addLine and before start_checkout / process_payment.' Also provides guidance on error handling and retry strategy: 'so the orchestrating agent can retry with a different code or proceed without a discount.' No alternative tool is suggested, but the sequencing and fallback behavior are clearly documented.

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