get_coupon
Retrieve a specific coupon by its ID from the Stream payment platform to access discount details and apply to purchases.
Instructions
Get a single coupon by ID.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| coupon_id | Yes |
Implementation Reference
- src/stream_mcp/tools/coupons.py:78-88 (handler)The get_coupon tool handler function - accepts a coupon_id and retrieves a single coupon from the Stream API
@mcp.tool async def get_coupon( coupon_id: str, ctx: Context = None, # type: ignore[assignment] ) -> dict[str, Any]: """Get a single coupon by ID.""" client = await get_client(ctx) try: return await client.get(f"{_BASE}/{coupon_id}") except StreamAPIError as exc: return _err(exc) - CouponResponse schema defining the structure of data returned by the get_coupon tool
class CouponResponse(BaseModel): """Subset of fields returned by the Stream API for a coupon.""" id: str name: str | None = None type: str | None = None value: float | None = None status: str | None = None created_at: str | None = None model_config = {"extra": "allow"} - src/stream_mcp/tools/coupons.py:24-28 (registration)The register function that registers the get_coupon tool with FastMCP using the @mcp.tool decorator
def register(mcp: FastMCP) -> None: """Register all coupon tools on *mcp*.""" @mcp.tool async def create_coupon( - src/stream_mcp/tools/__init__.py:27-27 (registration)Call to coupons.register(mcp) which triggers registration of the get_coupon tool
coupons.register(mcp) - src/stream_mcp/server.py:66-66 (registration)Call to register_all_tools which ultimately registers get_coupon on the FastMCP instance
register_all_tools(mcp)