Skip to main content
Glama
hectortemich

@deonpay/mcp-server

by hectortemich

Get subscription plan details

deonpay_get_subscription

Retrieve a subscription plan by UUID to see aggregated subscriber counts and the 10 most recent charges. Use this to get a quick health overview of a plan.

Instructions

Fetch a single subscription plan by UUID, including aggregated stats (active_subscribers, total_subscribers) and the most recent 10 recurring charges across all subscribers. Use this when the user wants a quick health view of a specific plan ('how is the Premium plan doing this month'). For per-subscriber detail use deonpay_list_customer_subscriptions filtered by subscription_id.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesSubscription plan UUID.

Implementation Reference

  • Handler function for deonpay_get_subscription: a safeHandler wrapping a GET request to /subscriptions/{id}. It takes a 'id' (UUID) parameter, URL-encodes it, and calls the DeonPay API client to fetch the subscription plan details.
    safeHandler(async ({ id }) => {
      return client.get(`/subscriptions/${encodeURIComponent(id)}`);
    }),
  • Input schema for deonpay_get_subscription: requires a single 'id' parameter of type string with UUID format validation, described as 'Subscription plan UUID.'
    inputSchema: {
      id: z.string().uuid().describe("Subscription plan UUID."),
    },
  • Registration of the 'deonpay_get_subscription' tool on the MCP server via server.registerTool(), with title 'Get subscription plan details' and a description explaining its purpose.
    server.registerTool(
      "deonpay_get_subscription",
      {
        title: "Get subscription plan details",
        description:
          "Fetch a single subscription plan by UUID, including aggregated stats (active_subscribers, total_subscribers) and the most recent 10 recurring charges across all subscribers. Use this when the user wants a quick health view of a specific plan ('how is the Premium plan doing this month'). For per-subscriber detail use deonpay_list_customer_subscriptions filtered by subscription_id.",
        inputSchema: {
          id: z.string().uuid().describe("Subscription plan UUID."),
        },
      },
      safeHandler(async ({ id }) => {
        return client.get(`/subscriptions/${encodeURIComponent(id)}`);
      }),
    );
  • The registerAllTools function calls registerSubscriptionTools(server, client) which registers the deonpay_get_subscription tool among others.
    export function registerAllTools(server: McpServer, client: DeonpayClient): void {
      registerLinkTools(server, client);
      registerCheckoutTools(server, client);
      registerTransactionTools(server, client);
      registerProductTools(server, client);
      registerSubscriptionTools(server, client);
      registerCustomerSubscriptionTools(server, client);
      registerCustomerTools(server, client);
      registerMetricsTools(server, client);
    }
  • The safeHandler utility wraps the tool handler with try/catch, converting results to pretty-printed JSON and errors to MCP-shaped error results.
    export function safeHandler<TArgs>(
      fn: (args: TArgs) => Promise<unknown>,
    ): (args: TArgs) => Promise<CallToolResult> {
      return async (args: TArgs) => {
        try {
          const value = await fn(args);
          return jsonResult(value);
        } catch (err) {
          return errorResult(err);
        }
      };
    }
    
    /**
     * Encodes the local part / full email for use in path segments. RFC 3986 says
     * `@` is reserved as a sub-delim, so encodeURIComponent is the safe choice.
     */
    export function encodePathSegment(value: string): string {
      return encodeURIComponent(value);
    }
    
    /**
     * Strips undefined / null / empty-string entries from a body before sending.
     * The DeonPay API accepts missing fields cleanly but treating "" as a valid
     * value would override server-side defaults — usually not what the LLM means.
     */
    export function compact<T extends Record<string, unknown>>(obj: T): Partial<T> {
      const out: Record<string, unknown> = {};
      for (const [key, value] of Object.entries(obj)) {
        if (value === undefined || value === null) continue;
        if (typeof value === "string" && value.trim() === "") continue;
        out[key] = value;
      }
      return out as Partial<T>;
    }
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, but description discloses key behavioral details: returns aggregated stats and limits to 10 recent recurring charges. Lacks mention of error behavior or required permissions, but adequate for a simple read operation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, no fluff, front-loaded with the main action and key details.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Description fully covers what the tool returns (stats and recent charges) and provides usage context via sibling reference. For a simple fetch with one parameter, no gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% with clear description for 'id' parameter. Description repeats 'by UUID' but adds no new semantic value beyond schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Clearly states action ('Fetch') and resource ('single subscription plan by UUID'), and specifies included data (aggregated stats and recent 10 charges). Differentiates from sibling tools like deonpay_get_customer_subscription and deonpay_list_subscriptions.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly tells when to use ('when the user wants a quick health view of a specific plan') and provides a clear alternative for per-subscriber detail (deonpay_list_customer_subscriptions).

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/hectortemich/deonpay-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server