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

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:

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/Mohammed-Rashad/stream'

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