Skip to main content
Glama

list_payments

Retrieve and filter GoCardless payment records by status, subscription, or mandate to monitor transaction activity.

Instructions

List payments from GoCardless

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoNumber of payments to retrieve (default: 50)
statusNoFilter by payment status (pending_customer_approval, pending_submission, submitted, confirmed, paid_out, cancelled, customer_approval_denied, failed, charged_back)
subscriptionNoFilter by subscription ID (e.g., SB123)
mandateNoFilter by mandate ID (e.g., MD123)

Implementation Reference

  • Handler implementation for list_payments tool: constructs params from arguments, calls client.payments.list(), formats and returns list of payments.
    elif name == "list_payments":
        params = {"limit": arguments.get("limit", 50)}
        if "status" in arguments:
            params["status"] = arguments["status"]
        if "subscription" in arguments:
            params["subscription"] = arguments["subscription"]
        if "mandate" in arguments:
            params["mandate"] = arguments["mandate"]
    
        payments = client.payments.list(params=params)
        result = []
        for payment in payments.records:
            result.append(
                {
                    "id": payment.id,
                    "amount": payment.amount,
                    "currency": payment.currency,
                    "status": payment.status,
                    "description": payment.description,
                    "created_at": payment.created_at,
                }
            )
        return [
            types.TextContent(
                type="text",
                text=f"Found {len(result)} payments:\n{_format_json(result)}",
            )
        ]
  • Registration of the list_payments tool in handle_list_tools(), including name, description, and input schema definition.
    types.Tool(
        name="list_payments",
        description="List payments from GoCardless",
        inputSchema={
            "type": "object",
            "properties": {
                "limit": {
                    "type": "integer",
                    "description": "Number of payments to retrieve (default: 50)",
                },
                "status": {
                    "type": "string",
                    "description": "Filter by payment status (pending_customer_approval, pending_submission, submitted, confirmed, paid_out, cancelled, customer_approval_denied, failed, charged_back)",
                },
                "subscription": {
                    "type": "string",
                    "description": "Filter by subscription ID (e.g., SB123)",
                },
                "mandate": {
                    "type": "string",
                    "description": "Filter by mandate ID (e.g., MD123)",
                },
            },
        },
    ),
  • Input schema definition for the list_payments tool, defining optional parameters for filtering payments.
    inputSchema={
        "type": "object",
        "properties": {
            "limit": {
                "type": "integer",
                "description": "Number of payments to retrieve (default: 50)",
            },
            "status": {
                "type": "string",
                "description": "Filter by payment status (pending_customer_approval, pending_submission, submitted, confirmed, paid_out, cancelled, customer_approval_denied, failed, charged_back)",
            },
            "subscription": {
                "type": "string",
                "description": "Filter by subscription ID (e.g., SB123)",
            },
            "mandate": {
                "type": "string",
                "description": "Filter by mandate ID (e.g., MD123)",
            },
        },
  • Helper function get_client() used by all tools including list_payments to initialize the GoCardless client.
    def get_client() -> gocardless_pro.Client:
        """Initialize and return GoCardless client."""
        access_token = os.environ.get("GOCARDLESS_ACCESS_TOKEN")
        if not access_token:
            raise ValueError("GOCARDLESS_ACCESS_TOKEN environment variable is required")
    
        environment = os.environ.get("GOCARDLESS_ENVIRONMENT", "sandbox")
        return gocardless_pro.Client(access_token=access_token, environment=environment)
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the action ('List payments') but doesn't describe how the tool behaves: whether it returns all payments or is paginated (implied by the 'limit' parameter but not explained), what the default ordering is, whether it requires authentication, or what the output format looks like. For a list operation with no annotation coverage, this leaves significant gaps.

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

Conciseness5/5

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

The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It's front-loaded with the core action and resource, making it easy to parse. Every part of the description earns its place by conveying essential information.

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 of a list operation with filtering parameters, no annotations, and no output schema, the description is incomplete. It doesn't address key behavioral aspects like pagination, authentication needs, or output structure, which are critical for an agent to use the tool effectively. The high schema coverage helps with parameters but doesn't compensate for the lack of operational context.

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 input schema has 100% description coverage, with clear documentation for all four parameters (limit, status, subscription, mandate). The description doesn't add any parameter-specific information beyond what's in the schema, such as explaining how filters combine or providing examples beyond the enum values. Given the high schema coverage, a baseline score of 3 is appropriate.

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 verb 'List' and the resource 'payments from GoCardless', making the purpose immediately understandable. However, it doesn't differentiate this tool from sibling tools like 'get_payment' or 'list_payouts', which would require specifying this is for retrieving multiple payments with optional filtering rather than a single payment or other resource types.

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 that 'get_payment' is for retrieving a single payment by ID, 'list_payouts' is for a different resource, or that this tool is appropriate for filtered bulk retrieval. Without such context, the agent must infer usage from the tool name alone.

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/jmceleney/gocardless-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server