Skip to main content
Glama
block

Square MCP Server

by block

invoices

Create, search, update, and manage Square invoices through the Square MCP Server to handle billing and payment tracking.

Instructions

Manage invoice operations

Args: operation: The operation to perform. Valid operations: - create_invoice - search_invoices - get_invoice - update_invoice - cancel_invoice - publish_invoice - delete_invoice params: Dictionary of parameters for the specific operation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
operationYes
paramsYes

Implementation Reference

  • The primary handler for the 'invoices' tool. It is registered with @mcp.tool() and handles multiple sub-operations by calling corresponding Square API methods based on the 'operation' parameter.
    @mcp.tool() async def invoices( operation: str, params: Dict[str, Any] ) -> Dict[str, Any]: """Manage invoice operations Args: operation: The operation to perform. Valid operations: - create_invoice - search_invoices - get_invoice - update_invoice - cancel_invoice - publish_invoice - delete_invoice params: Dictionary of parameters for the specific operation """ try: match operation: case "create_invoice": result = square_client.invoices.create_invoice(params) case "search_invoices": result = square_client.invoices.search_invoices(params) case "get_invoice": result = square_client.invoices.get_invoice(**params) case "update_invoice": result = square_client.invoices.update_invoice(**params) case "cancel_invoice": result = square_client.invoices.cancel_invoice(**params) case "publish_invoice": result = square_client.invoices.publish_invoice(**params) case "delete_invoice": result = square_client.invoices.delete_invoice(**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)))
  • Docstring providing schema information: input parameters 'operation' (enum of sub-operations) and 'params' (dict for the specific API call).
    """Manage invoice operations Args: operation: The operation to perform. Valid operations: - create_invoice - search_invoices - get_invoice - update_invoice - cancel_invoice - publish_invoice - delete_invoice params: Dictionary of parameters for the specific operation """
  • The @mcp.tool() decorator registers the 'invoices' function as an MCP tool.
    @mcp.tool()

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