Skip to main content
Glama

list_customers

Retrieve customer records from GoCardless to manage payment accounts and view client information. Use limit parameter to control the number of results returned.

Instructions

List all customers from GoCardless

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoNumber of customers to retrieve (default: 50)

Implementation Reference

  • Handler for the 'list_customers' tool. Retrieves a list of customers from GoCardless using the client API, limited by optional 'limit' parameter, and returns formatted JSON text content.
    if name == "list_customers": limit = arguments.get("limit", 50) customers = client.customers.list(params={"limit": limit}) result = [] for customer in customers.records: result.append( { "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, } ) return [ types.TextContent( type="text", text=f"Found {len(result)} customers:\n{_format_json(result)}", ) ]
  • Registration of the 'list_customers' tool in the @server.list_tools() handler, including its description and input schema.
    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)", } }, }, ),
  • Input schema definition for the 'list_customers' tool, defining an optional 'limit' integer parameter.
    inputSchema={ "type": "object", "properties": { "limit": { "type": "integer", "description": "Number of customers to retrieve (default: 50)", } }, },
  • Helper function to initialize and return the GoCardless client used in the tool 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)
  • Helper function to format JSON output used in the tool response.
    def _format_json(data: Any) -> str: """Format data as JSON string.""" import json return json.dumps(data, indent=2)

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