Skip to main content
Glama

get_customer

Retrieve a specific customer's information by providing their unique ID to access detailed records in the Stream system.

Instructions

Get a single customer record by ID.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
customer_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The get_customer tool handler function decorated with @mcp.tool. Takes a customer_id parameter, gets the API client, makes a GET request to /api/v2/consumers/{customer_id}, and handles StreamAPIError exceptions.
    @mcp.tool
    async def get_customer(
        customer_id: str,
        ctx: Context = None,  # type: ignore[assignment]
    ) -> dict[str, Any]:
        """Get a single customer record by ID."""
        client = await get_client(ctx)
        try:
            return await client.get(f"{_BASE}/{customer_id}")
        except StreamAPIError as exc:
            return _err(exc)
  • The register function that defines and registers all customer tools including get_customer on the FastMCP instance.
    def register(mcp: FastMCP) -> None:
        """Register all customer tools on *mcp*."""
    
        @mcp.tool
        async def create_customer(
            name: str,
            phone_number: str | None = None,
            email: str | None = None,
            external_id: str | None = None,
            iban: str | None = None,
            alias: str | None = None,
            comment: str | None = None,
            preferred_language: str | None = None,
            communication_methods: list[str] | None = None,
            ctx: Context = None,  # type: ignore[assignment]
        ) -> dict[str, Any]:
            """Create a new customer in Stream.
    
            Provide at least a *name*. Optionally include *phone_number*, *email*,
            *external_id*, *iban*, *alias*, *comment*, *preferred_language* (EN/AR),
            and *communication_methods* (WHATSAPP, EMAIL, SMS).
            """
            body = CreateCustomerRequest(
                name=name, phone_number=phone_number, email=email,
                external_id=external_id, iban=iban, alias=alias,
                comment=comment, preferred_language=preferred_language,
                communication_methods=communication_methods,
            )
            client = await get_client(ctx)
            try:
                return await client.post(_BASE, body.model_dump(exclude_none=True))
            except StreamAPIError as exc:
                return _err(exc)
    
        @mcp.tool
        async def list_customers(
            page: int = 1,
            limit: int = 20,
            ctx: Context = None,  # type: ignore[assignment]
        ) -> dict[str, Any]:
            """List / search customers with pagination.
    
            Returns a paginated list of customers.
            """
            params: dict[str, Any] = {"page": page, "limit": limit}
            client = await get_client(ctx)
            try:
                return await client.get(_BASE, params=params)
            except StreamAPIError as exc:
                return _err(exc)
    
        @mcp.tool
        async def get_customer(
            customer_id: str,
            ctx: Context = None,  # type: ignore[assignment]
        ) -> dict[str, Any]:
            """Get a single customer record by ID."""
            client = await get_client(ctx)
            try:
                return await client.get(f"{_BASE}/{customer_id}")
            except StreamAPIError as exc:
                return _err(exc)
    
        @mcp.tool
        async def update_customer(
            customer_id: str,
            name: str | None = None,
            phone_number: str | None = None,
            email: str | None = None,
            external_id: str | None = None,
            iban: str | None = None,
            alias: str | None = None,
            comment: str | None = None,
            preferred_language: str | None = None,
            communication_methods: list[str] | None = None,
            ctx: Context = None,  # type: ignore[assignment]
        ) -> dict[str, Any]:
            """Update fields on an existing customer.
    
            Only the fields you provide will be changed; others remain untouched.
            """
            body = UpdateCustomerRequest(
                name=name, phone_number=phone_number, email=email,
                external_id=external_id, iban=iban, alias=alias,
                comment=comment, preferred_language=preferred_language,
                communication_methods=communication_methods,
            )
            client = await get_client(ctx)
            try:
                return await client.put(
                    f"{_BASE}/{customer_id}",
                    body.model_dump(exclude_none=True),
                )
            except StreamAPIError as exc:
                return _err(exc)
    
        @mcp.tool
        async def delete_customer(
            customer_id: str,
            ctx: Context = None,  # type: ignore[assignment]
        ) -> dict[str, Any]:
            """Soft-delete a customer by ID.
    
            The customer record is archived but not permanently removed.
            """
            client = await get_client(ctx)
            try:
                return await client.delete(f"{_BASE}/{customer_id}")
            except StreamAPIError as exc:
                return _err(exc)
  • CustomerResponse Pydantic model defining the expected structure of customer data returned by the API (used as schema documentation for the get_customer tool response).
    class CustomerResponse(BaseModel):
        """Subset of fields returned by the Stream API for a customer."""
    
        id: str
        name: str | None = None
        email: str | None = None
        phone: str | None = None
        created_at: str | None = None
    
        model_config = {"extra": "allow"}
  • Calls customers.register(mcp) to register all customer tools including get_customer onto the FastMCP instance.
    payment_links.register(mcp)
    customers.register(mcp)
  • Server entry point that calls register_all_tools(mcp) to register all tools including get_customer on the FastMCP instance.
    # Register all tools & resources onto 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 implies a read-only operation but doesn't specify error handling, permissions, rate limits, or response format. For a tool with no annotation coverage, this leaves significant gaps in understanding its behavior.

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 no wasted words. It is front-loaded with the core purpose, making it efficient and easy to understand.

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?

Given the tool's simplicity (single parameter, read-only operation) and the presence of an output schema, the description is reasonably complete. It covers the basic purpose, though it could benefit from more behavioral context, especially since no annotations are provided.

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%, but the description adds meaning by specifying that the parameter is for retrieving by ID. However, it doesn't detail the ID format or constraints. With one parameter, the baseline is 4, but the lack of additional semantic info reduces the score slightly.

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 verb ('Get') and resource ('a single customer record'), specifying retrieval by ID. It distinguishes from sibling tools like 'list_customers' by focusing on a single record, though it doesn't explicitly name alternatives.

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?

No guidance is provided on when to use this tool versus alternatives such as 'list_customers' or 'create_customer', nor does it mention prerequisites like authentication or ID format. The description only states what it does, not when to use it.

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