Skip to main content
Glama
hectortemich

@deonpay/mcp-server

by hectortemich

Get merchant metrics

deonpay_get_merchant_metrics

Fetch key business metrics including revenue, transactions, subscriptions snapshot, and revenue mix, with configurable time period.

Instructions

Fetch a curated set of business metrics for the merchant. Use this as the FIRST tool for high-level questions: 'how much have I sold this month', 'what is my MRR', 'how is my conversion rate trending', 'how many active subscribers do I have'. Returns: revenue (gross/net/refunded in centavos), transactions (total/successful/failed/conversion_rate as %/average_ticket in centavos), subscriptions snapshot (active_subscribers, trialing_subscribers, past_due, mrr in centavos, churn_rate as %), and revenue_mix (recurring vs one_time, in centavos). IMPORTANT: subscriptions.active/trialing/past_due AND mrr are SNAPSHOTS — they ignore period. mrr is always a 30-day run-rate. revenue, transactions, churn_rate and revenue_mix DO honor period.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
periodNoTime window. Default '30d'. 'all' goes back to epoch.
environmentNoOverride the environment to query. The DeonPay API only honors this if it matches the environment baked into the API token; otherwise it is silently ignored. Useful when the same dashboard exposes both envs.

Implementation Reference

  • The actual handler logic for the 'deonpay_get_merchant_metrics' tool. It calls client.get('/merchant/metrics', compact(args)) which sends a GET request to the DeonPay API endpoint /api/v1/merchant/metrics with query parameters (period, environment) stripped of undefined/null values.
    safeHandler(async (args) => {
      return client.get("/merchant/metrics", compact(args));
    }),
  • Input schema for the tool: an optional 'period' enum (today, 7d, 30d, 90d, ytd, all) and an optional 'environment' (sandbox, production) from the shared EnvironmentSchema.
    {
      title: "Get merchant metrics",
      description:
        "Fetch a curated set of business metrics for the merchant. Use this as the FIRST tool for high-level questions: 'how much have I sold this month', 'what is my MRR', 'how is my conversion rate trending', 'how many active subscribers do I have'. Returns: revenue (gross/net/refunded in centavos), transactions (total/successful/failed/conversion_rate as %/average_ticket in centavos), subscriptions snapshot (active_subscribers, trialing_subscribers, past_due, mrr in centavos, churn_rate as %), and revenue_mix (recurring vs one_time, in centavos). IMPORTANT: subscriptions.active/trialing/past_due AND mrr are SNAPSHOTS — they ignore `period`. mrr is always a 30-day run-rate. revenue, transactions, churn_rate and revenue_mix DO honor `period`.",
      inputSchema: {
        period: z
          .enum(["today", "7d", "30d", "90d", "ytd", "all"])
          .optional()
          .describe("Time window. Default '30d'. 'all' goes back to epoch."),
        environment: EnvironmentSchema.optional(),
      },
    },
  • The tool is registered via registerMetricsTools(server, client) which is called from registerAllTools, the central registry that wires all tool modules into the MCP server.
    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 'compact' helper removes undefined/null/empty-string fields from the args object before sending as query parameters, ensuring the API defaults are honored.
    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>;
    }
  • The 'safeHandler' wrapper catches any thrown errors and converts them into MCP-shaped error results so the LLM receives a clear error message.
    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);
        }
      };
    }
Behavior5/5

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

With no annotations, the description carries full burden. It clearly explains the return fields, including important nuances: subscriptions fields ignore `period`, mrr is always a 30-day run-rate, while revenue/transactions/churn_rate honor `period`. This goes beyond simple field listing.

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 well-structured: a clear purpose statement, concrete examples, then a detailed list of return fields with annotations. Every sentence adds value, and it's not overly verbose.

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?

Despite no output schema, the description enumerates all return categories with subfields and units. It covers edge cases like snapshot behavior. For a metrics tool, this is sufficiently complete.

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

Parameters4/5

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

Input schema has 100% description coverage, so baseline is 3. The description adds extra context about `period` affecting some fields and not others, which is valuable. For `environment`, it adds no further meaning beyond the 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?

The description clearly states it fetches a curated set of business metrics for the merchant, with specific examples like 'how much have I sold this month'. This distinguishes it from sibling tools which focus on creating or retrieving individual entities.

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 explicitly says 'Use this as the FIRST tool for high-level questions', providing clear when-to-use guidance. It does not explicitly mention when not to use or alternatives, but the context implies it's for overviews.

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