get_subscription
Retrieve subscription details by ID from GoCardless to access payment information, mandate links, and manage recurring billing data.
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
| Name | Required | Description | Default |
|---|---|---|---|
| subscription_id | Yes | The GoCardless subscription ID (e.g., SB123) |
Implementation Reference
- src/gocardless_mcp/server.py:451-472 (handler)Handler that executes the get_subscription tool: fetches subscription by ID using GoCardless client and returns formatted details.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)) ]
- src/gocardless_mcp/server.py:205-218 (schema)Schema definition for the get_subscription tool, including 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"], }, ),
- src/gocardless_mcp/server.py:35-36 (registration)Registration of tools via the MCP list_tools handler, which includes get_subscription in its returned list.@server.list_tools() async def handle_list_tools() -> list[types.Tool]:
- src/gocardless_mcp/server.py:249-250 (registration)Registration of tool handlers via the MCP call_tool handler, which dispatches to get_subscription logic.@server.call_tool() async def handle_call_tool(