Skip to main content
Glama

get_subscription

Retrieve subscription details by ID to access payment information, mandate links, and manage recurring billing data through GoCardless payment platform.

Instructions

Get subscription by ID. Returns links.mandate - use get_mandate then get_customer for full details, or use get_subscription_details instead.

Input Schema

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

Implementation Reference

  • The core handler logic for the 'get_subscription' tool. It extracts the subscription_id from arguments, fetches the subscription using the GoCardless client, constructs a result dictionary with key fields and links, formats it as JSON, and returns it as TextContent.
    elif name == "get_subscription": subscription_id = arguments["subscription_id"] subscription = client.subscriptions.get(subscription_id) result = { "id": subscription.id, "amount": subscription.amount, "currency": subscription.currency, "status": subscription.status, "interval_unit": subscription.interval_unit, "interval": subscription.interval, "created_at": subscription.created_at, "name": subscription.name, "start_date": subscription.start_date, "end_date": subscription.end_date, "metadata": subscription.metadata if hasattr(subscription, 'metadata') else {}, "links": { "mandate": subscription.links.mandate if hasattr(subscription, 'links') else None, }, } return [ types.TextContent(type="text", text=_format_json(result)) ]
  • Registration of the 'get_subscription' tool in the list_tools() handler. Defines the tool name, description, and input schema requiring 'subscription_id'.
    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"], }, ),
  • Input schema for the 'get_subscription' tool, specifying an object with a required 'subscription_id' string property.
    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