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()
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 like 'create_invoice' and 'delete_invoice' which imply mutations, but doesn't describe permissions, side effects, or response formats. Critical details such as whether deletions are permanent or if operations require authentication are missing, making it inadequate for a tool with multiple action types.

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 appropriately sized and front-loaded with a brief purpose statement followed by a structured list of operations. Each sentence serves a clear function: the first sets context, and the second details parameters efficiently. There's no unnecessary verbosity, making it easy to parse.

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 tool's complexity (multiple operations including mutations like delete), lack of annotations, no output schema, and nested parameters, the description is incomplete. It fails to explain behavioral traits, return values, or error handling, leaving gaps that could hinder an AI agent from using the tool correctly in varied contexts.

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?

The description adds significant value beyond the input schema, which has 0% coverage and only generic titles. It enumerates valid operations for the 'operation' parameter and explains that 'params' is a dictionary for operation-specific parameters. This clarifies the structure and purpose of both parameters, compensating well for the schema's lack of detail.

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 invoice operations' which provides a general purpose but lacks specificity about what 'manage' entails. It distinguishes from siblings like 'payments' or 'orders' by focusing on invoices, but doesn't clearly articulate the exact actions or resources involved beyond listing operations in the parameters section.

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 exclusions. For example, it doesn't clarify if this should be used instead of sibling tools like 'payments' for invoice-related tasks, leaving usage ambiguous.

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