Skip to main content
Glama

get_payment

Retrieve a specific payment's details using its unique GoCardless ID to view transaction status and information.

Instructions

Get a specific payment by ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
payment_idYesThe GoCardless payment ID (e.g., PM123)

Implementation Reference

  • Handler implementation for the 'get_payment' tool. Retrieves payment details by ID using the GoCardless client API and returns formatted JSON response including metadata and links.
    elif name == "get_payment":
        payment_id = arguments["payment_id"]
        payment = client.payments.get(payment_id)
        result = {
            "id": payment.id,
            "amount": payment.amount,
            "currency": payment.currency,
            "status": payment.status,
            "description": payment.description,
            "created_at": payment.created_at,
            "charge_date": payment.charge_date,
            "metadata": payment.metadata if hasattr(payment, 'metadata') else {},
            "links": {
                "mandate": payment.links.mandate if hasattr(payment, 'links') and hasattr(payment.links, 'mandate') else None,
                "subscription": payment.links.subscription if hasattr(payment, 'links') and hasattr(payment.links, 'subscription') else None,
            },
        }
        return [
            types.TextContent(type="text", text=_format_json(result))
        ]
  • Tool schema definition including input schema for 'payment_id' parameter, registered in the list_tools handler.
    types.Tool(
        name="get_payment",
        description="Get a specific payment by ID",
        inputSchema={
            "type": "object",
            "properties": {
                "payment_id": {
                    "type": "string",
                    "description": "The GoCardless payment ID (e.g., PM123)",
                }
            },
            "required": ["payment_id"],
        },
    ),
  • Registration of the 'get_payment' tool within the list_tools method, which returns all available tools with their schemas.
    @server.list_tools()
    async def handle_list_tools() -> list[types.Tool]:
        """List available GoCardless tools."""
        return [
            types.Tool(
                name="list_customers",
                description="List all customers from GoCardless",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "limit": {
                            "type": "integer",
                            "description": "Number of customers to retrieve (default: 50)",
                        }
                    },
                },
            ),
            types.Tool(
                name="get_customer",
                description="Get a specific customer by ID",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "customer_id": {
                            "type": "string",
                            "description": "The GoCardless customer ID (e.g., CU123)",
                        }
                    },
                    "required": ["customer_id"],
                },
            ),
            types.Tool(
                name="create_customer",
                description="Create a new customer in GoCardless",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "email": {
                            "type": "string",
                            "description": "Customer email address",
                        },
                        "given_name": {
                            "type": "string",
                            "description": "Customer first name",
                        },
                        "family_name": {
                            "type": "string",
                            "description": "Customer last name",
                        },
                        "company_name": {
                            "type": "string",
                            "description": "Customer company name (optional)",
                        },
                    },
                    "required": ["email"],
                },
            ),
            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)",
                        },
                    },
                },
            ),
            types.Tool(
                name="get_payment",
                description="Get a specific payment by ID",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "payment_id": {
                            "type": "string",
                            "description": "The GoCardless payment ID (e.g., PM123)",
                        }
                    },
                    "required": ["payment_id"],
                },
            ),
            types.Tool(
                name="create_payment",
                description="Create a new payment in GoCardless",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "amount": {
                            "type": "integer",
                            "description": "Amount in minor currency unit (e.g., 1000 for £10.00)",
                        },
                        "currency": {
                            "type": "string",
                            "description": "ISO 4217 currency code (e.g., GBP, EUR)",
                        },
                        "mandate_id": {
                            "type": "string",
                            "description": "ID of the mandate to use for this payment",
                        },
                        "description": {
                            "type": "string",
                            "description": "Payment description",
                        },
                    },
                    "required": ["amount", "currency", "mandate_id"],
                },
            ),
            types.Tool(
                name="list_mandates",
                description="List mandates from GoCardless",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "limit": {
                            "type": "integer",
                            "description": "Number of mandates to retrieve (default: 50)",
                        },
                        "customer": {
                            "type": "string",
                            "description": "Filter by customer ID",
                        },
                    },
                },
            ),
            types.Tool(
                name="get_mandate",
                description="Get a specific mandate by ID",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "mandate_id": {
                            "type": "string",
                            "description": "The GoCardless mandate ID (e.g., MD123)",
                        }
                    },
                    "required": ["mandate_id"],
                },
            ),
            types.Tool(
                name="list_subscriptions",
                description="List subscriptions from GoCardless",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "limit": {
                            "type": "integer",
                            "description": "Number of subscriptions to retrieve (default: 50)",
                        },
                        "status": {
                            "type": "string",
                            "description": "Filter by subscription status",
                        },
                    },
                },
            ),
            types.Tool(
                name="get_subscription",
                description="Get subscription by ID. Returns links.mandate - use get_mandate then get_customer for full details, or use get_subscription_details instead.",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "subscription_id": {
                            "type": "string",
                            "description": "The GoCardless subscription ID (e.g., SB123)",
                        }
                    },
                    "required": ["subscription_id"],
                },
            ),
            types.Tool(
                name="get_subscription_details",
                description="Get complete subscription info including mandate and customer in one call",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "subscription_id": {
                            "type": "string",
                            "description": "The GoCardless subscription ID (e.g., SB123)",
                        }
                    },
                    "required": ["subscription_id"],
                },
            ),
            types.Tool(
                name="list_payouts",
                description="List payouts from GoCardless",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "limit": {
                            "type": "integer",
                            "description": "Number of payouts to retrieve (default: 50)",
                        }
                    },
                },
            ),
        ]
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 tool retrieves a payment by ID but doesn't describe what happens if the ID is invalid (e.g., error response), whether authentication is required, rate limits, or the format of the returned data. For a read operation with zero annotation coverage, this leaves significant gaps in understanding the tool's behavior.

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 with zero waste: 'Get a specific payment by ID'. It is front-loaded with the core purpose, appropriately sized for a simple retrieval tool, and every word earns its place without redundancy or fluff.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (single parameter, no output schema, no annotations), the description is minimally adequate but incomplete. It covers the basic purpose but lacks context on usage guidelines, behavioral traits (e.g., error handling), and output details. For a simple read tool, this might suffice, but it doesn't provide enough information for optimal agent use without additional assumptions.

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 the 'payment_id' parameter fully documented in the schema (type: string, description: 'The GoCardless payment ID (e.g., PM123)'). The description adds no additional meaning beyond what the schema provides, as it only mentions 'by ID' without elaborating on format or examples. Baseline score of 3 is appropriate since the schema does the heavy lifting.

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 ('Get') and resource ('a specific payment by ID'), making the purpose immediately understandable. It distinguishes from sibling tools like 'list_payments' by specifying retrieval of a single payment rather than listing multiple. However, it doesn't explicitly differentiate from other get_* tools (e.g., 'get_customer', 'get_mandate') beyond the resource type.

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 when to use 'get_payment' instead of 'list_payments' (e.g., for a known payment ID), nor does it reference other sibling tools like 'get_customer' or 'get_subscription' for related data. There's no discussion of prerequisites, error conditions, or typical use cases.

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