list_payments
Retrieve and filter payment records from GoCardless by status, subscription, or mandate to monitor transaction history and track payment status.
Instructions
List payments from GoCardless
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Number of payments to retrieve (default: 50) | |
| mandate | No | Filter by mandate ID (e.g., MD123) | |
| status | No | Filter by payment status (pending_customer_approval, pending_submission, submitted, confirmed, paid_out, cancelled, customer_approval_denied, failed, charged_back) | |
| subscription | No | Filter by subscription ID (e.g., SB123) |
Implementation Reference
- src/gocardless_mcp/server.py:319-346 (handler)The specific handler logic within handle_call_tool for executing the 'list_payments' tool. It constructs query parameters from input arguments, fetches payments using the GoCardless client.payments.list(), extracts relevant fields, and returns formatted JSON text content.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)}", ) ]
- src/gocardless_mcp/server.py:92-116 (registration)Registers the 'list_payments' tool in the handle_list_tools() function, including its 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)", }, }, }, ),
- src/gocardless_mcp/server.py:97-114 (schema)Defines the input schema for the 'list_payments' tool, specifying optional parameters for limit, status, subscription, and mandate filters."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)", }, },