Skip to main content
Glama

get_subscription_details

Retrieve complete subscription information including mandate and customer details in a single API call using the subscription ID.

Instructions

Get complete subscription info including mandate and customer in one call

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
subscription_idYesThe GoCardless subscription ID (e.g., SB123)

Implementation Reference

  • Handler logic for get_subscription_details tool: fetches subscription by ID, then linked mandate and customer, formats them into a nested JSON structure and returns as text content.
    elif name == "get_subscription_details": subscription_id = arguments["subscription_id"] # Get subscription subscription = client.subscriptions.get(subscription_id) # Get mandate mandate = client.mandates.get(subscription.links.mandate) # Get customer customer = client.customers.get(mandate.links.customer) result = { "subscription": { "id": subscription.id, "name": subscription.name, "amount": subscription.amount, "currency": subscription.currency, "status": subscription.status, "interval_unit": subscription.interval_unit, "interval": subscription.interval, "start_date": subscription.start_date, "end_date": subscription.end_date, "created_at": subscription.created_at, "metadata": subscription.metadata if hasattr(subscription, 'metadata') else {}, }, "mandate": { "id": mandate.id, "reference": mandate.reference, "status": mandate.status, "scheme": mandate.scheme, "created_at": mandate.created_at, "metadata": mandate.metadata if hasattr(mandate, 'metadata') else {}, }, "customer": { "id": customer.id, "email": customer.email, "given_name": customer.given_name, "family_name": customer.family_name, "company_name": customer.company_name, "address_line1": customer.address_line1, "address_line2": customer.address_line2, "city": customer.city, "postal_code": customer.postal_code, "country_code": customer.country_code, "created_at": customer.created_at, "metadata": customer.metadata if hasattr(customer, 'metadata') else {}, }, } return [ types.TextContent(type="text", text=_format_json(result)) ]
  • Registration of the get_subscription_details tool in the list_tools handler, including its name, description, and input schema requiring 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"], }, ),
  • Input schema for get_subscription_details tool: requires a subscription_id string.
    inputSchema={ "type": "object", "properties": { "subscription_id": { "type": "string", "description": "The GoCardless subscription ID (e.g., SB123)", } }, "required": ["subscription_id"], }, ),

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