Skip to main content
Glama

get_subscription_external_invoices

Retrieve e-commerce orders (external invoices) linked to a subscription. Supports pagination and optional attribute inclusion.

Instructions

List e-commerce orders (external invoices) linked to a subscription. GET /subscriptions/{subscriptionId}/external-invoices. Returns paginated external invoice records. Optional: include, pageNo, itemPerPage.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
subscriptionIdYesSubscription ID (required)
includeNoAttributes to include
pageNoNoPage number (default: 1)
itemPerPageNoItems per page (default: 25)

Implementation Reference

  • Handler function that parses args, validates with zod schema, then calls the service to fetch external invoices for a subscription.
    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 { subscriptionId, include, pageNo, itemPerPage } = parsed.data;
      return handleToolCall(() =>
        subscriptionService.getSubscriptionExternalInvoices(client, subscriptionId, {
          include,
          pageNo,
          itemPerPage,
        })
      );
    }
  • Service function that makes the GET /subscriptions/{subscriptionId}/external-invoices API call with optional query params (include, pageNo, itemPerPage).
    /** External (e-commerce) orders linked to the subscription. GET /subscriptions/{id}/external-invoices */
    export async function getSubscriptionExternalInvoices(
      client: Client,
      subscriptionId: string,
      params?: SubscriptionExternalInvoicesParams
    ): Promise<PaginatedResponse<unknown>> {
      const search = new URLSearchParams();
      if (params?.include) search.append("include", params.include);
      if (params?.pageNo != null) search.append("pageNo", String(params.pageNo));
      if (params?.itemPerPage != null) search.append("itemPerPage", String(params.itemPerPage));
      const q = search.toString();
      return client.get<PaginatedResponse<unknown>>(
        `/subscriptions/${subscriptionId}/external-invoices${q ? `?${q}` : ""}`
      );
    }
  • Zod schema defining input validation: subscriptionId (required string), optional include, pageNo, itemPerPage.
    const schema = z.object({
      subscriptionId: z.string().min(1, "subscriptionId is required"),
      include: z.string().optional(),
      pageNo: z.number().int().min(1).optional(),
      itemPerPage: z.number().int().min(1).optional(),
    });
  • Exported Tool object with 'definition' (name, description, inputSchema) and 'handler'.
    export const getSubscriptionExternalInvoicesTool: Tool = {
      definition,
      handler,
    };
  • Tool is included in the registerSubscriptionTools() array, and re-exported on line 60.
        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?

Given no annotations, the description mentions pagination and returns records, which adds behavioral context. However, it does not explicitly state it's read-only (implied by GET) or discuss any side effects, rate limits, or auth requirements.

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 concise sentences with front-loaded purpose, no redundant information. Every sentence adds value.

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?

No output schema is provided, so the description should explain return values. It mentions paginated records but lacks details on invoice structure. The description is adequate but not complete for an agent to fully understand the output.

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%, so the schema already documents parameters. The description adds minimal value by restating optional parameters and providing the endpoint context for subscriptionId, but nothing 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 the action (list) and resource (external invoices for a subscription), includes the endpoint, and implicitly differentiates from sibling tools like list_external_invoices and get_subscription_invoices.

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

Usage Guidelines3/5

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

No explicit when-to-use or alternatives are provided, but the context from sibling names implies usage for subscription-specific external invoices. The description lacks guidance on when not to use it.

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