create_customer
Add a new customer to GoCardless payment system by providing email, name, and optional company details to enable payment processing.
Instructions
Create a new customer in GoCardless
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| company_name | No | Customer company name (optional) | |
| Yes | Customer email address | ||
| family_name | No | Customer last name | |
| given_name | No | Customer first name |
Implementation Reference
- src/gocardless_mcp/server.py:66-91 (registration)Registration of the create_customer tool including its input schema definition.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"], }, ),
- src/gocardless_mcp/server.py:300-317 (handler)Handler function that executes the create_customer tool by calling the GoCardless API to create a customer with the provided parameters.elif name == "create_customer": params = { "email": arguments["email"], } if "given_name" in arguments: params["given_name"] = arguments["given_name"] if "family_name" in arguments: params["family_name"] = arguments["family_name"] if "company_name" in arguments: params["company_name"] = arguments["company_name"] customer = client.customers.create(params=params) return [ types.TextContent( type="text", text=f"Customer created successfully:\n{_format_json({'id': customer.id, 'email': customer.email})}", ) ]
- src/gocardless_mcp/server.py:14-21 (helper)Helper function to initialize the GoCardless client, used by the create_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)