Skip to main content
Glama

get_customer_subscriptions

Retrieve all subscriptions for a customer by ID. Optionally include rate plans, charges, and other details with pagination support.

Instructions

List subscriptions for a customer. GET /customers/{customerId}/subscriptions. Supports pagination and include (e.g. rateplan, rateplanCharge).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
customerIdYesCustomer ID (required)
pageNoNoPage number (default: 1)
itemPerPageNoItems per page (default: 25)
includeNoComma-separated: rateplan, rateplanCharge, chargeTier, etc.

Implementation Reference

  • The handler function that validates inputs via Zod schema, then calls customerService.getCustomerSubscriptions to fetch subscriptions for a given customer.
    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("; "));
      }
      const { customerId, pageNo, itemPerPage, include } = parsed.data;
      return handleToolCall(() =>
        customerService.getCustomerSubscriptions(client, customerId, { pageNo, itemPerPage, include })
      );
    }
  • Zod schema defining input validation: customerId (required string), pageNo, itemPerPage, include (optional).
    const schema = z.object({
      customerId: z.string().min(1, "customerId is required"),
      pageNo: z.number().optional(),
      itemPerPage: z.number().optional(),
      include: z.string().optional(),
    });
  • MCP tool definition with name 'get_customer_subscriptions', description, and input JSON Schema (properties: customerId, pageNo, itemPerPage, include).
    const definition = {
      name: "get_customer_subscriptions",
      description:
        "List subscriptions for a customer. GET /customers/{customerId}/subscriptions. Supports pagination and include (e.g. rateplan, rateplanCharge).",
      inputSchema: {
        type: "object" as const,
        properties: {
          customerId: { type: "string", description: "Customer ID (required)" },
          pageNo: { type: "number", description: "Page number (default: 1)" },
          itemPerPage: { type: "number", description: "Items per page (default: 25)" },
          include: { type: "string", description: "Comma-separated: rateplan, rateplanCharge, chargeTier, etc." },
        },
        required: ["customerId"],
      },
    };
  • Exported Tool object wrapping definition and handler, used for registration.
    export const getCustomerSubscriptionsTool: Tool = {
      definition,
      handler,
    };
  • Service-layer function that performs the HTTP GET request to /customers/{customerId}/subscriptions with optional pagination/include params.
    export async function getCustomerSubscriptions(
      client: Client,
      customerId: string,
      params?: PaginationIncludeParams
    ): Promise<PaginatedResponse<unknown>> {
      const search = new URLSearchParams();
      if (params) appendParams(search, params as Record<string, unknown>);
      return client.get<PaginatedResponse<unknown>>(
        `/customers/${customerId}/subscriptions${queryString(search)}`
      );
    }
Behavior4/5

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

The description discloses pagination support and the 'include' parameter for nested data (e.g., rateplan, rateplanCharge). Without annotations, this provides useful behavioral context beyond the schema, though it omits details like authentication requirements or exact output format.

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 well-structured sentences. The first states purpose, the second adds key technical details (pagination, includes). No unnecessary words or repetition.

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

Completeness3/5

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

The description lacks information about the return format (e.g., array of subscription objects) despite no output schema being provided. It adequately covers input and query behavior but is incomplete for an agent to fully understand the output without guesswork.

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?

Input schema has 100% coverage, so the description's value is limited. It confirms the URL structure and gives examples for the 'include' parameter, but the schema already describes parameters adequately. No significant addition 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 the tool lists subscriptions for a specific customer, using the verb 'list' and the resource 'subscriptions for a customer.' It implies a filter by customerId, distinguishing it from sibling tools like list_subscriptions that likely list all subscriptions without such filtering.

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 indicates when to use the tool (for a specific customer's subscriptions) but does not explicitly mention when not to use it or name alternative tools. The context is clear enough for an agent to infer appropriate usage.

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