Skip to main content
Glama

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
NameRequiredDescriptionDefault
coupon_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • 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"}
  • 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(
  • Call to coupons.register(mcp) which triggers registration of the get_coupon tool
    coupons.register(mcp)
  • Call to register_all_tools which ultimately registers get_coupon on the FastMCP instance
    register_all_tools(mcp)
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 retrieves a coupon but doesn't mention whether this is a read-only operation, what permissions are required, error handling (e.g., for invalid IDs), or response format. For a retrieval tool with zero annotation coverage, this leaves significant behavioral gaps.

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, clear sentence with zero wasted words. It front-loads the essential information ('Get a single coupon') and efficiently specifies the method ('by ID'). Every part of the sentence contributes directly to understanding the tool's function.

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 low complexity (single parameter, retrieval operation) and the presence of an output schema (which handles return values), the description is minimally adequate. However, with no annotations and 0% schema description coverage, it lacks context on permissions, errors, or behavioral nuances. It meets basic needs but leaves room for improvement in transparency.

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?

The description mentions 'by ID', which aligns with the 'coupon_id' parameter in the schema. However, schema description coverage is 0%, so the schema provides no parameter descriptions. The description adds minimal semantic context (it's an ID) but doesn't explain format, constraints, or examples. With 1 parameter and low schema coverage, this is a baseline score.

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 ('Get') and resource ('a single coupon by ID'), making the purpose unambiguous. It distinguishes this tool from sibling tools like 'list_coupons' by specifying retrieval of a single item rather than a collection. However, it doesn't explicitly differentiate from other 'get_' tools like 'get_customer' or 'get_product' beyond the resource type.

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. It doesn't mention when to prefer 'get_coupon' over 'list_coupons' (e.g., when you have a specific coupon ID), nor does it reference other sibling tools like 'deactivate_coupon' for related operations. Usage is implied by the name but not explicitly stated.

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