Skip to main content
Glama
block

Square MCP Server

by block

orders

Manage Square orders and checkout operations including creating, retrieving, updating, and processing payments for transactions.

Instructions

Manage orders and checkout operations

Args: operation: The operation to perform. Valid operations: Orders: - create_order - batch_retrieve_orders - calculate_order - clone_order - search_orders - pay_order - update_order Checkout: - create_checkout - create_payment_link Custom Attributes: - upsert_order_custom_attribute - list_order_custom_attribute_definitions params: Dictionary of parameters for the specific operation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
operationYes
paramsYes

Implementation Reference

  • The primary handler function for the 'orders' MCP tool. It is registered via @mcp.tool() decorator and implements multiple Square Orders API operations (create_order, batch_retrieve_orders, etc.) based on the 'operation' parameter, proxying calls to square_client.orders.* methods.
    @mcp.tool() async def orders( operation: str, params: Dict[str, Any] ) -> Dict[str, Any]: """Manage orders and checkout operations Args: operation: The operation to perform. Valid operations: Orders: - create_order - batch_retrieve_orders - calculate_order - clone_order - search_orders - pay_order - update_order Checkout: - create_checkout - create_payment_link Custom Attributes: - upsert_order_custom_attribute - list_order_custom_attribute_definitions params: Dictionary of parameters for the specific operation """ try: match operation: # Orders case "create_order": result = square_client.orders.create_order(params) case "batch_retrieve_orders": result = square_client.orders.batch_retrieve_orders(params) case "calculate_order": result = square_client.orders.calculate_order(params) case "clone_order": result = square_client.orders.clone_order(params) case "search_orders": result = square_client.orders.search_orders(params) case "pay_order": result = square_client.orders.pay_order(params) case "update_order": result = square_client.orders.update_order(**params) # Checkout case "create_checkout": result = square_client.checkout.create_checkout(params) case "create_payment_link": result = square_client.checkout.create_payment_link(params) # Custom Attributes case "upsert_order_custom_attribute": result = square_client.orders.upsert_order_custom_attribute(**params) case "list_order_custom_attribute_definitions": result = square_client.orders.list_order_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)))
  • The @mcp.tool() decorator registers the 'orders' function as an MCP tool.
    @mcp.tool()
  • Docstring defining the input schema: 'operation' (str, one of listed operations) and 'params' (Dict[str, Any] for the specific operation). FastMCP likely uses this for tool schema generation.
    """Manage orders and checkout operations Args: operation: The operation to perform. Valid operations: Orders: - create_order - batch_retrieve_orders - calculate_order - clone_order - search_orders - pay_order - update_order Checkout: - create_checkout - create_payment_link Custom Attributes: - upsert_order_custom_attribute - list_order_custom_attribute_definitions params: Dictionary of parameters for the specific operation """

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