Skip to main content
Glama
hectortemich

@deonpay/mcp-server

by hectortemich

Get customer subscription details

deonpay_get_customer_subscription

Fetch a customer subscription by UUID to review plan details, recent charges with status, and cancellation flags. Use for investigating subscriber history or failed charges.

Instructions

Fetch a single customer subscription by UUID. Includes the plan denormalized, the last 20 recurring charges (each with status success/failed/skipped/completed, charge_type auto/manual/renewal_link, attempt_number, error_message and timestamps), and cancellation flags. Use this when investigating a specific subscriber's history or a failed charge ('why did Juan's subscription go past_due?').

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesCustomer subscription UUID.

Implementation Reference

  • The handler function that executes the tool logic. It takes an object with a single 'id' parameter (UUID), encodes it, and calls client.get() on the /customer-subscriptions/{id} endpoint to fetch a single customer subscription details.
      safeHandler(async ({ id }) => {
        return client.get(`/customer-subscriptions/${encodeURIComponent(id)}`);
      }),
    );
  • The input schema for the tool, defined inline: requires a single 'id' field typed as a UUID string via Zod (z.string().uuid()).
    {
      title: "Get customer subscription details",
      description:
        "Fetch a single customer subscription by UUID. Includes the plan denormalized, the last 20 recurring charges (each with status success/failed/skipped/completed, charge_type auto/manual/renewal_link, attempt_number, error_message and timestamps), and cancellation flags. Use this when investigating a specific subscriber's history or a failed charge ('why did Juan's subscription go past_due?').",
      inputSchema: {
        id: z.string().uuid().describe("Customer subscription UUID."),
      },
  • The tool is registered via server.registerTool() with the name 'deonpay_get_customer_subscription' within the registerCustomerSubscriptionTools function.
    server.registerTool(
      "deonpay_get_customer_subscription",
      {
        title: "Get customer subscription details",
        description:
          "Fetch a single customer subscription by UUID. Includes the plan denormalized, the last 20 recurring charges (each with status success/failed/skipped/completed, charge_type auto/manual/renewal_link, attempt_number, error_message and timestamps), and cancellation flags. Use this when investigating a specific subscriber's history or a failed charge ('why did Juan's subscription go past_due?').",
        inputSchema: {
          id: z.string().uuid().describe("Customer subscription UUID."),
        },
      },
      safeHandler(async ({ id }) => {
        return client.get(`/customer-subscriptions/${encodeURIComponent(id)}`);
      }),
    );
  • The registerCustomerSubscriptionTools function is imported from customer-subscriptions.ts and called in registerAllTools() — this is the top-level registration chain.
    import { registerCustomerSubscriptionTools } from "./customer-subscriptions.js";
    import { registerCustomerTools } from "./customers.js";
    import { registerMetricsTools } from "./metrics.js";
    
    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 helper wraps the handler with try/catch, converting thrown errors into MCP-shaped error results via jsonResult/errorResult.
    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);
    }
Behavior4/5

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

With no annotations, the description discloses key output elements: denormalized plan, last 20 recurring charges with status, charge_type, attempt_number, error_message, and timestamps, plus cancellation flags. It does not detail error behavior or rate limits, but the provided information is sufficient for the tool's read-only nature.

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?

The description is two sentences, front-loaded with the core purpose, then adding valuable details and a usage example. Every sentence earns its place with no wasted words.

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

Completeness4/5

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

Given the tool's simplicity (1 param, no output schema, no annotations), the description provides a solid overview of the response content. It could mention what happens on missing UUID, but overall it covers the essential context for an agent to use it effectively.

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?

The schema covers the single parameter 'id' with full description (UUID). The description adds context by mentioning 'by UUID' but does not elaborate beyond what the schema already provides, meeting the baseline expectation.

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?

The description clearly states the tool fetches a single customer subscription by UUID, specifying what is included (plan, last 20 charges, cancellation flags). It distinguishes from siblings like 'deonpay_get_subscription' by emphasizing 'customer subscription' and denormalized plan details.

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

Usage Guidelines4/5

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

The description provides a concrete use case: investigating a subscriber's history or a failed charge, with an example question ('why did Juan's subscription go past_due?'). It guides the agent on when to use this tool, though it does not explicitly exclude alternatives.

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