Skip to main content
Glama

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
NameRequiredDescriptionDefault
subscription_idYesThe GoCardless subscription ID (e.g., SB123)

Implementation Reference

  • 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))
        ]
  • 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"],
        },
    ),
  • 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]:
  • Registration of tool handlers via the MCP call_tool handler, which dispatches to get_subscription logic.
    @server.call_tool()
    async def handle_call_tool(

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