Skip to main content
Glama

deactivate_coupon

Deactivate a coupon to prevent further redemptions. This tool invalidates coupon codes by ID, ensuring they can no longer be used for discounts.

Instructions

Deactivate a coupon so it can no longer be redeemed.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
coupon_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The deactivate_coupon tool handler that deactivates a coupon by setting is_active=False and making a PUT request to the Stream API.
    @mcp.tool
    async def deactivate_coupon(
        coupon_id: str,
        ctx: Context = None,  # type: ignore[assignment]
    ) -> dict[str, Any]:
        """Deactivate a coupon so it can no longer be redeemed."""
        body = UpdateCouponRequest(is_active=False)
        client = await get_client(ctx)
        try:
            return await client.put(
                f"{_BASE}/{coupon_id}",
                body.model_dump(exclude_none=True),
            )
        except StreamAPIError as exc:
            return _err(exc)
  • UpdateCouponRequest schema defining the request body for updating coupons, including the is_active field used for deactivation.
    class UpdateCouponRequest(BaseModel):
        """Request body for updating a coupon."""
    
        name: str | None = Field(default=None, min_length=1, max_length=80, description="Updated coupon name.")
        discount_value: float | None = Field(default=None, ge=0, description="Updated discount value.")
        currency: str | None = Field(default=None, description="Updated currency code.")
        is_percentage: bool | None = Field(default=None, description="Updated discount type.")
        is_active: bool | None = Field(default=None, description="Updated active status.")
  • The register function that contains all coupon tool registrations including deactivate_coupon.
    def register(mcp: FastMCP) -> None:
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool deactivates a coupon, implying a mutation, but lacks details on permissions required, whether the action is reversible, rate limits, or error conditions. This is a significant gap for a mutation tool with zero annotation coverage.

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 a single, efficient sentence that front-loads the key action and outcome without unnecessary words. Every part of the sentence contributes directly to understanding the tool's function, making it appropriately sized and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (a mutation with one parameter) and the presence of an output schema (which handles return values), the description is minimally adequate. However, with no annotations and incomplete behavioral details, it leaves gaps in understanding the full context, such as side effects or error handling.

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 description does not mention parameters, but with only one parameter (coupon_id) and 0% schema description coverage, it implicitly clarifies that the tool operates on a specific coupon. Since there are zero parameters described in the schema, the baseline is 4, as the description's focus on coupon deactivation adds sufficient context for the single input.

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 ('deactivate') and resource ('coupon') with the outcome ('so it can no longer be redeemed'), making the purpose unambiguous. However, it does not explicitly differentiate from sibling tools like 'archive_product' or 'void_invoice', which might involve similar deactivation concepts in different contexts.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives, such as whether to use 'deactivate_coupon' over 'delete_customer' for coupon-related actions or how it compares to 'get_coupon' for checking status. There is no mention of prerequisites, exclusions, or contextual triggers for usage.

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/streampayments/stream'

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