Skip to main content
Glama
block

Square MCP Server

by block

loyalty

Manage Square loyalty programs, accounts, and promotions. Create programs, handle customer accounts, accumulate or adjust points, and run promotions.

Instructions

Manage loyalty operations

Args:
    operation: The operation to perform. Valid operations:
        Programs:
            - create_loyalty_program
            - retrieve_loyalty_program
        Accounts:
            - create_loyalty_account
            - search_loyalty_accounts
            - retrieve_loyalty_account
            - accumulate_loyalty_points
            - adjust_loyalty_points
            - search_loyalty_events
        Promotions:
            - create_loyalty_promotion
            - cancel_loyalty_promotion
    params: Dictionary of parameters for the specific operation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
operationYes
paramsYes

Implementation Reference

  • The primary handler for the 'loyalty' tool. Registered via @mcp.tool() decorator. Dispatches loyalty operations (e.g., create_loyalty_program, accumulate_loyalty_points) to the Square API client based on the 'operation' parameter. Includes input description in docstring serving as informal schema, error handling, and returns API response.
    @mcp.tool()
    async def loyalty(
        operation: str,
        params: Dict[str, Any]
    ) -> Dict[str, Any]:
        """Manage loyalty operations
    
        Args:
            operation: The operation to perform. Valid operations:
                Programs:
                    - create_loyalty_program
                    - retrieve_loyalty_program
                Accounts:
                    - create_loyalty_account
                    - search_loyalty_accounts
                    - retrieve_loyalty_account
                    - accumulate_loyalty_points
                    - adjust_loyalty_points
                    - search_loyalty_events
                Promotions:
                    - create_loyalty_promotion
                    - cancel_loyalty_promotion
            params: Dictionary of parameters for the specific operation
        """
        try:
            match operation:
                # Programs
                case "create_loyalty_program":
                    result = square_client.loyalty.create_loyalty_program(params)
                case "retrieve_loyalty_program":
                    result = square_client.loyalty.retrieve_loyalty_program(**params)
                # Accounts
                case "create_loyalty_account":
                    result = square_client.loyalty.create_loyalty_account(params)
                case "search_loyalty_accounts":
                    result = square_client.loyalty.search_loyalty_accounts(params)
                case "retrieve_loyalty_account":
                    result = square_client.loyalty.retrieve_loyalty_account(**params)
                case "accumulate_loyalty_points":
                    result = square_client.loyalty.accumulate_loyalty_points(**params)
                case "adjust_loyalty_points":
                    result = square_client.loyalty.adjust_loyalty_points(**params)
                case "search_loyalty_events":
                    result = square_client.loyalty.search_loyalty_events(params)
                # Promotions
                case "create_loyalty_promotion":
                    result = square_client.loyalty.create_loyalty_promotion(**params)
                case "cancel_loyalty_promotion":
                    result = square_client.loyalty.cancel_loyalty_promotion(**params)
                case _:
                    raise McpError(INVALID_PARAMS, ErrorData(message=f"Invalid operation: {operation}"))
    
            return result.body
        except Exception as e:
            raise McpError(INTERNAL_ERROR, ErrorData(message=str(e)))
Behavior2/5

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

No annotations are provided, so the description carries full burden. It mentions operations like 'create' and 'adjust' which imply mutations, but doesn't disclose permissions, side effects, rate limits, or response behavior. The description is minimal and lacks behavioral context needed for safe invocation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is efficiently structured with a brief purpose statement followed by clear parameter documentation using bullet points. Every sentence adds value, though it could be more front-loaded with a stronger purpose statement.

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

Completeness2/5

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

Given 2 parameters with nested objects, no annotations, and no output schema, the description is incomplete. It covers parameter semantics well but lacks critical behavioral details, output expectations, and error handling, making it inadequate for safe tool use.

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?

With 0% schema description coverage, the description compensates by detailing the 'operation' parameter with specific valid values categorized by type (Programs, Accounts, Promotions). It also explains that 'params' is a dictionary for operation-specific parameters, adding meaningful context beyond the bare schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states the tool 'Manage loyalty operations' which gives a general purpose but lacks specificity about what 'manage' entails. It distinguishes from siblings like 'bookings' or 'payments' by focusing on loyalty, but doesn't clearly articulate the core function beyond a broad category.

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. The description lists operations but doesn't explain context, prerequisites, or comparisons with sibling tools. Users must infer usage from the operation list alone.

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/block/square-mcp'

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