Skip to main content
Glama
block

Square MCP Server

by block

payments

Process and manage transactions, refunds, disputes, and gift cards through Square's payment system for business operations.

Instructions

Manage payment operations using Square API

Args:
    operation: The operation to perform. Valid operations:
        Payments:
            - list_payments
            - create_payment
            - get_payment
            - update_payment
            - cancel_payment
        Refunds:
            - refund_payment
            - list_refunds
            - get_refund
        Disputes:
            - list_disputes
            - retrieve_dispute
            - accept_dispute
            - create_dispute_evidence
        Gift Cards:
            - create_gift_card
            - link_customer_to_gift_card
            - retrieve_gift_card
            - list_gift_cards
        Bank Accounts:
            - list_bank_accounts
            - get_bank_account
    params: Dictionary of parameters for the specific operation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
operationYes
paramsYes

Implementation Reference

  • The primary handler for the 'payments' MCP tool. Registered via @mcp.tool() decorator. Dispatches various Square API calls for payments, refunds, disputes, gift cards, and bank accounts based on the 'operation' string parameter. Input schema defined in docstring and type hints.
    @mcp.tool()
    async def payments(
        operation: str,
        params: Dict[str, Any]
    ) -> Dict[str, Any]:
        """Manage payment operations using Square API
    
        Args:
            operation: The operation to perform. Valid operations:
                Payments:
                    - list_payments
                    - create_payment
                    - get_payment
                    - update_payment
                    - cancel_payment
                Refunds:
                    - refund_payment
                    - list_refunds
                    - get_refund
                Disputes:
                    - list_disputes
                    - retrieve_dispute
                    - accept_dispute
                    - create_dispute_evidence
                Gift Cards:
                    - create_gift_card
                    - link_customer_to_gift_card
                    - retrieve_gift_card
                    - list_gift_cards
                Bank Accounts:
                    - list_bank_accounts
                    - get_bank_account
            params: Dictionary of parameters for the specific operation
        """
        try:
            match operation:
                # Payments
                case "list_payments":
                    result = square_client.payments.list_payments(**params)
                case "create_payment":
                    result = square_client.payments.create_payment(params)
                case "get_payment":
                    result = square_client.payments.get_payment(**params)
                case "update_payment":
                    result = square_client.payments.update_payment(**params)
                case "cancel_payment":
                    result = square_client.payments.cancel_payment(**params)
                # Refunds
                case "refund_payment":
                    result = square_client.refunds.refund_payment(params)
                case "list_refunds":
                    result = square_client.refunds.list_payment_refunds(**params)
                case "get_refund":
                    result = square_client.refunds.get_payment_refund(**params)
                # Disputes
                case "list_disputes":
                    result = square_client.disputes.list_disputes(**params)
                case "retrieve_dispute":
                    result = square_client.disputes.retrieve_dispute(**params)
                case "accept_dispute":
                    result = square_client.disputes.accept_dispute(**params)
                case "create_dispute_evidence":
                    result = square_client.disputes.create_dispute_evidence(**params)
                # Gift Cards
                case "create_gift_card":
                    result = square_client.gift_cards.create_gift_card(params)
                case "link_customer_to_gift_card":
                    result = square_client.gift_cards.link_customer_to_gift_card(**params)
                case "retrieve_gift_card":
                    result = square_client.gift_cards.retrieve_gift_card(**params)
                case "list_gift_cards":
                    result = square_client.gift_cards.list_gift_cards(**params)
                # Bank Accounts
                case "list_bank_accounts":
                    result = square_client.bank_accounts.list_bank_accounts(**params)
                case "get_bank_account":
                    result = square_client.bank_accounts.get_bank_account(**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 the full burden of behavioral disclosure. It lists operations but fails to describe critical traits like authentication requirements, rate limits, error handling, or side effects (e.g., 'cancel_payment' might be irreversible). The description is operational but lacks transparency on how these actions behave in practice.

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 structured with a brief overview and a categorized list of operations, which is front-loaded. However, it includes extensive bullet points that could be condensed, and some redundancy exists (e.g., listing all operations without summarizing). It's moderately efficient but could be more streamlined.

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 the complexity (multiple operation types, nested 'params' object) and lack of annotations and output schema, the description is incomplete. It covers operation options but omits details on parameter formats, return values, error cases, and integration context. For a tool with such broad functionality, this leaves the agent under-informed.

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 adds significant meaning beyond the input schema, which has 0% coverage. It enumerates valid operations for the 'operation' parameter and notes that 'params' is a dictionary for specific operations, clarifying their roles. However, it doesn't detail the structure of 'params' or provide examples, leaving gaps in parameter understanding.

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 tool's purpose as managing payment operations using Square API, which is a specific verb+resource combination. It distinguishes itself from siblings like 'invoices' or 'orders' by focusing on payments, refunds, disputes, gift cards, and bank accounts. However, it doesn't explicitly contrast with all siblings, such as 'customers' or 'subscriptions', which might overlap in payment contexts.

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 lists operations but doesn't explain scenarios for choosing 'payments' over sibling tools like 'invoices' or 'orders', nor does it mention prerequisites or exclusions. This leaves the agent without contextual usage cues.

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