Skip to main content
Glama
block

Square MCP Server

by block

customers

Manage Square customer data by creating, updating, retrieving, and deleting customer records, groups, segments, and custom attributes.

Instructions

Manage customer operations

Args:
    operation: The operation to perform. Valid operations:
        Customers:
            - list_customers
            - create_customer
            - delete_customer
            - retrieve_customer
            - update_customer
            - search_customers
        Groups:
            - create_customer_group
            - delete_customer_group
            - list_customer_groups
            - retrieve_customer_group
            - update_customer_group
        Segments:
            - list_customer_segments
            - retrieve_customer_segment
        Custom Attributes:
            - create_customer_custom_attribute_definition
            - delete_customer_custom_attribute_definition
            - list_customer_custom_attribute_definitions
    params: Dictionary of parameters for the specific operation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
operationYes
paramsYes

Implementation Reference

  • The primary handler for the 'customers' MCP tool. This async function, registered with @mcp.tool(), accepts an 'operation' string and 'params' dict, then uses a match statement to call the appropriate Square API method on customers, groups, segments, or custom attributes.
    @mcp.tool()
    async def customers(
        operation: str,
        params: Dict[str, Any]
    ) -> Dict[str, Any]:
        """Manage customer operations
    
        Args:
            operation: The operation to perform. Valid operations:
                Customers:
                    - list_customers
                    - create_customer
                    - delete_customer
                    - retrieve_customer
                    - update_customer
                    - search_customers
                Groups:
                    - create_customer_group
                    - delete_customer_group
                    - list_customer_groups
                    - retrieve_customer_group
                    - update_customer_group
                Segments:
                    - list_customer_segments
                    - retrieve_customer_segment
                Custom Attributes:
                    - create_customer_custom_attribute_definition
                    - delete_customer_custom_attribute_definition
                    - list_customer_custom_attribute_definitions
            params: Dictionary of parameters for the specific operation
        """
        try:
            match operation:
                # Customers
                case "list_customers":
                    result = square_client.customers.list_customers(**params)
                case "create_customer":
                    result = square_client.customers.create_customer(params)
                case "delete_customer":
                    result = square_client.customers.delete_customer(**params)
                case "retrieve_customer":
                    result = square_client.customers.retrieve_customer(**params)
                case "update_customer":
                    result = square_client.customers.update_customer(**params)
                case "search_customers":
                    result = square_client.customers.search_customers(params)
                # Groups
                case "create_customer_group":
                    result = square_client.customer_groups.create_customer_group(params)
                case "delete_customer_group":
                    result = square_client.customer_groups.delete_customer_group(**params)
                case "list_customer_groups":
                    result = square_client.customer_groups.list_customer_groups(**params)
                case "retrieve_customer_group":
                    result = square_client.customer_groups.retrieve_customer_group(**params)
                case "update_customer_group":
                    result = square_client.customer_groups.update_customer_group(**params)
                # Segments
                case "list_customer_segments":
                    result = square_client.customer_segments.list_customer_segments(**params)
                case "retrieve_customer_segment":
                    result = square_client.customer_segments.retrieve_customer_segment(**params)
                # Custom Attributes
                case "create_customer_custom_attribute_definition":
                    result = square_client.customer_custom_attributes.create_customer_custom_attribute_definition(params)
                case "delete_customer_custom_attribute_definition":
                    result = square_client.customer_custom_attributes.delete_customer_custom_attribute_definition(**params)
                case "list_customer_custom_attribute_definitions":
                    result = square_client.customer_custom_attributes.list_customer_custom_attribute_definitions(**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?

With no annotations provided, the description carries full burden for behavioral disclosure. While it lists operations that imply various behaviors (create, delete, update, retrieve), it doesn't disclose any behavioral traits like authentication requirements, rate limits, side effects, or response formats. The description merely catalogs operations without explaining their behavioral implications.

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

Conciseness3/5

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

The description is reasonably structured with an initial statement followed by organized parameter documentation. However, the operation list is quite lengthy and could benefit from better front-loading of key information. Some redundancy exists in the operation naming (e.g., 'customer' appears repeatedly in operation names).

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?

For a complex tool with 2 parameters, no annotations, no output schema, and nested objects in parameters, the description is incomplete. While it documents operation values well, it lacks crucial information about authentication, error handling, response formats, and the structure of the 'params' dictionary. The agent would struggle to use this tool effectively without additional context.

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 and 2 parameters, the description provides substantial value by documenting the 'operation' parameter with a comprehensive list of valid values organized by category. It explains that 'params' is a dictionary for operation-specific parameters, though it doesn't detail what those parameters might be. This significantly compensates for the schema's lack of documentation.

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 'Manage customer operations' which provides a general purpose but is vague about what specific operations are available. It lists operations in the Args section, but the initial statement lacks specificity about the verb+resource relationship. It doesn't distinguish this tool from potential siblings like 'business' or 'orders' which might also manage customer-related data.

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 any prerequisites, context for choosing specific operations, or relationships to sibling tools. The agent must infer usage from the operation list alone without any when/when-not guidance.

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