Skip to main content
Glama

list_subscriptions

Retrieve a list of subscriptions with optional filters by status, customer, gateway, date range, and pagination.

Instructions

List subscriptions. GET /subscriptions. Optional: include, query, orderBy, sortBy, filterId, status (exact status), customerId (customer id), companyGatewayId (subscription company gateway id), dateFrom/dateTo (createdAt range; dateFrom from 00:00:00, dateTo through 23:59:59; invalid dates are ignored), itemPerPage, pageNo. Examples: /v1/subscriptions?status=active ; /v1/subscriptions?customerId=123&companyGatewayId=8 ; /v1/subscriptions?dateFrom=2026-01-01&dateTo=2026-01-31 ; /v1/subscriptions?status=paused&customerId=123&dateFrom=2026-01-01&dateTo=2026-01-31.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
includeNoAttributes to include
queryNoSearch query
orderByNoSort column
sortByNoSort direction
filterIdNoFilter ID
statusNoFilter by exact subscription status
customerIdNoFilter by customer id
companyGatewayIdNoFilter by subscription company gateway id
dateFromNoFilter createdAt from this date (applies from 00:00:00); invalid dates are ignored
dateToNoFilter createdAt to this date (applies through 23:59:59); invalid dates are ignored
itemPerPageNoItems per page
pageNoNoPage number

Implementation Reference

  • Handler function that parses arguments via zod schema, then calls subscriptionService.listSubscriptions().
    async function handler(client: Client, args: Record<string, unknown> | undefined) {
      const parsed = schema.safeParse(args);
      if (!parsed.success) {
        return errorResult(parsed.error.errors.map((e) => e.message).join("; "));
      }
      return handleToolCall(() => subscriptionService.listSubscriptions(client, parsed.data));
    }
    
    export const listSubscriptionsTool: Tool = {
      definition,
      handler,
    };
  • Zod schema and JSON Schema input definition for list_subscriptions tool, defining all optional parameters (include, query, orderBy, sortBy, filterId, status, customerId, companyGatewayId, dateFrom, dateTo, itemPerPage, pageNo).
    import { z } from "zod";
    import type { Tool } from "../types.js";
    import type { Client } from "./helpers.js";
    import { errorResult, handleToolCall } from "./helpers.js";
    import * as subscriptionService from "../../services/subscriptionServices.js";
    
    const schema = z.object({
      include: z.string().optional(),
      query: z.string().optional(),
      orderBy: z.string().optional(),
      sortBy: z.string().optional(),
      filterId: z.number().int().optional(),
      status: z.enum(["active", "paused", "requestPayment", "archived"]).optional(),
      customerId: z.number().int().optional(),
      companyGatewayId: z.number().int().optional(),
      dateFrom: z.string().optional(),
      dateTo: z.string().optional(),
      itemPerPage: z.number().int().min(1).optional(),
      pageNo: z.number().int().min(1).optional(),
    });
    
    const definition = {
      name: "list_subscriptions",
      description:
        "List subscriptions. GET /subscriptions. Optional: include, query, orderBy, sortBy, filterId, status (exact status), customerId (customer id), companyGatewayId (subscription company gateway id), dateFrom/dateTo (createdAt range; dateFrom from 00:00:00, dateTo through 23:59:59; invalid dates are ignored), itemPerPage, pageNo. Examples: /v1/subscriptions?status=active ; /v1/subscriptions?customerId=123&companyGatewayId=8 ; /v1/subscriptions?dateFrom=2026-01-01&dateTo=2026-01-31 ; /v1/subscriptions?status=paused&customerId=123&dateFrom=2026-01-01&dateTo=2026-01-31.",
      inputSchema: {
        type: "object" as const,
        properties: {
          include: { type: "string", description: "Attributes to include" },
          query: { type: "string", description: "Search query" },
          orderBy: { type: "string", description: "Sort column" },
          sortBy: { type: "string", description: "Sort direction" },
          filterId: { type: "number", description: "Filter ID" },
          status: {
            type: "string",
            enum: ["active", "paused", "requestPayment", "archived"],
            description: "Filter by exact subscription status",
          },
          customerId: {
            type: "integer",
            format: "int64",
            description: "Filter by customer id",
          },
          companyGatewayId: {
            type: "integer",
            format: "int64",
            description: "Filter by subscription company gateway id",
          },
          dateFrom: {
            type: "string",
            format: "date",
            example: "2026-01-01",
            description: "Filter createdAt from this date (applies from 00:00:00); invalid dates are ignored",
          },
          dateTo: {
            type: "string",
            format: "date",
            example: "2026-01-31",
            description: "Filter createdAt to this date (applies through 23:59:59); invalid dates are ignored",
          },
          itemPerPage: { type: "number", description: "Items per page" },
          pageNo: { type: "number", description: "Page number" },
        },
        required: [],
      },
    };
  • TypeScript interface ListSubscriptionsParams used by the service layer.
    export interface ListSubscriptionsParams {
      include?: string;
      query?: string;
      orderBy?: string;
      sortBy?: string;
      filterId?: number;
      status?: SubscriptionStatus;
      customerId?: number;
      companyGatewayId?: number;
      dateFrom?: string;
      dateTo?: string;
      itemPerPage?: number;
      pageNo?: number;
    }
  • Service function listSubscriptions that builds URLSearchParams from params and makes a GET /subscriptions API call.
    export async function listSubscriptions(
      client: Client,
      params?: ListSubscriptionsParams
    ): Promise<PaginatedResponse<unknown>> {
      const search = new URLSearchParams();
      if (params?.include) search.append("include", params.include);
      if (params?.query) search.append("query", params.query);
      if (params?.orderBy) search.append("orderBy", params.orderBy ?? "");
      if (params?.sortBy) search.append("sortBy", params.sortBy ?? "");
      if (params?.filterId != null) search.append("filterId", String(params.filterId));
      if (params?.status) search.append("status", params.status);
      if (params?.customerId != null) search.append("customerId", String(params.customerId));
      if (params?.companyGatewayId != null) {
        search.append("companyGatewayId", String(params.companyGatewayId));
      }
      if (params?.dateFrom) search.append("dateFrom", params.dateFrom);
      if (params?.dateTo) search.append("dateTo", params.dateTo);
      if (params?.itemPerPage != null) search.append("itemPerPage", String(params.itemPerPage));
      if (params?.pageNo != null) search.append("pageNo", String(params.pageNo));
      const q = search.toString();
      return client.get<PaginatedResponse<unknown>>(`/subscriptions${q ? `?${q}` : ""}`);
    }
  • Registration: registerSubscriptionTools() returns listSubscriptionsTool as part of the array of all subscription tools.
    /** All 19 subscription tools. */
    export function registerSubscriptionTools(): Tool[] {
      return [
        listSubscriptionsTool,
        getSubscriptionTool,
        createSubscriptionTool,
        updateSubscriptionTool,
        deleteSubscriptionTool,
        updateSubscriptionStatusTool,
        getSubscriptionUpcomingChargesTool,
        getSubscriptionInvoicesTool,
        getSubscriptionLogsTool,
        getSubscriptionExternalInvoicesTool,
        listSubscriptionRatePlansTool,
        getSubscriptionRatePlanTool,
        addSubscriptionRatePlanTool,
        updateSubscriptionRatePlanTool,
        removeSubscriptionRatePlanTool,
        getSubscriptionRatePlanChargeTool,
        addSubscriptionRatePlanChargeTool,
        updateSubscriptionRatePlanChargeTool,
        removeSubscriptionRatePlanChargeTool,
      ];
    }
Behavior3/5

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

No annotations provided, so description carries burden. Discloses that invalid dates are ignored and date ranges are inclusive of specific times, but does not mention pagination behavior, rate limits, or response format.

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

Conciseness4/5

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

Description is focused and front-loaded with endpoint; parameters are listed concisely and grouped with examples. Slightly verbose but each sentence adds value.

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

Completeness2/5

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

Lacks explanation of return format, default sorting, or pagination defaults. With no output schema, description should cover what the response contains.

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?

Schema covers 100% of parameters with descriptions, providing baseline. Description adds value by explaining date-from/to behavior (00:00:00/23:59:59), and giving concrete usage examples, exceeding schema alone.

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 'list subscriptions' with HTTP endpoint, and is distinct from sibling tools like get_subscription (single) and create_subscription.

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?

Provides examples of common filtering scenarios (by status, customerId, date range), giving clear context for usage. However, does not explicitly differentiate from sibling list_customer_subscriptions which also filters by customer.

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/rhinosaas/rebillia-mcp-server'

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