Skip to main content
Glama

get_customer

Retrieve customer details by ID from GoCardless to access payment information, mandates, and subscription data for account management.

Instructions

Get a specific customer by ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
customer_idYesThe GoCardless customer ID (e.g., CU123)

Implementation Reference

  • Handler logic for the 'get_customer' tool: retrieves customer by ID from GoCardless API, formats response with customer details including address and metadata.
    elif name == "get_customer": customer_id = arguments["customer_id"] customer = client.customers.get(customer_id) result = { "id": customer.id, "email": customer.email, "given_name": customer.given_name, "family_name": customer.family_name, "company_name": customer.company_name, "created_at": customer.created_at, "address_line1": customer.address_line1, "address_line2": customer.address_line2, "city": customer.city, "postal_code": customer.postal_code, "country_code": customer.country_code, "metadata": customer.metadata if hasattr(customer, 'metadata') else {}, } return [ types.TextContent(type="text", text=_format_json(result)) ]
  • Registration of the 'get_customer' tool in the list_tools handler, including name, description, and input schema requiring customer_id.
    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"], }, ),
  • Helper function to create and return the GoCardless client instance, used by the get_customer handler.
    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)

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