Skip to main content
Glama

get_customer_invoices

List invoices for a customer with filtering by status, date range, subscription, and include options. Pagination supported.

Instructions

List invoices for a customer. GET /customers/{customerId}/invoices. Supports pagination (pageNo, itemPerPage), include (e.g. detail, transactions), status (authorized|posted|canceled|partialPaid|paid|voided|refund|partialRefund), dateFrom, dateTo, and subscriptionId.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
customerIdYesCustomer ID (required)
pageNoNoPage number (default: 1)
itemPerPageNoItems per page (default: 25)
includeNoComma-separated: detail, transactions, billruns, externalInvoices
statusNoFilter by invoice status
dateFromNoFilter invoices from date (YYYY-MM-DD)
dateToNoFilter invoices to date (YYYY-MM-DD)
subscriptionIdNoFilter by subscription ID

Implementation Reference

  • Handler function that validates input via Zod schema, then delegates to customerService.getCustomerInvoices to execute the API call.
    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, status, dateFrom, dateTo, subscriptionId } =
        parsed.data;
      return handleToolCall(() =>
        customerService.getCustomerInvoices(client, customerId, {
          pageNo,
          itemPerPage,
          include,
          status,
          dateFrom,
          dateTo,
          subscriptionId,
        })
      );
    }
  • Zod validation schema defining the input parameters for get_customer_invoices.
    const schema = z.object({
      customerId: z.string().min(1, "customerId is required"),
      pageNo: z.number().optional(),
      itemPerPage: z.number().optional(),
      include: z.string().optional(),
      status: z
        .enum([
          "authorized",
          "posted",
          "canceled",
          "partialPaid",
          "paid",
          "voided",
          "refund",
          "partialRefund",
        ])
        .optional(),
      dateFrom: z.string().optional(),
      dateTo: z.string().optional(),
      subscriptionId: z.string().optional(),
    });
  • MCP tool definition/registration metadata with name, description, and JSON Schema input schema.
    const definition = {
      name: "get_customer_invoices",
      description:
        "List invoices for a customer. GET /customers/{customerId}/invoices. Supports pagination (pageNo, itemPerPage), include (e.g. detail, transactions), status (authorized|posted|canceled|partialPaid|paid|voided|refund|partialRefund), dateFrom, dateTo, and subscriptionId.",
      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: detail, transactions, billruns, externalInvoices" },
          status: {
            type: "string",
            enum: [
              "authorized",
              "posted",
              "canceled",
              "partialPaid",
              "paid",
              "voided",
              "refund",
              "partialRefund",
            ],
            description: "Filter by invoice status",
          },
          dateFrom: { type: "string", format: "date", description: "Filter invoices from date (YYYY-MM-DD)" },
          dateTo: { type: "string", format: "date", description: "Filter invoices to date (YYYY-MM-DD)" },
          subscriptionId: { type: "string", description: "Filter by subscription ID" },
        },
        required: ["customerId"],
      },
    };
  • Registration of getCustomerInvoicesTool in the customer tools registry, making it available via registerCustomerTools().
    export function registerCustomerTools(): Tool[] {
      return [
        listCustomersTool,
        getCustomerTool,
        createCustomerTool,
        updateCustomerTool,
        deleteCustomerTool,
        getCustomerInvoicesTool,
        getCustomerUnpaidInvoicesTool,
        getCustomerSubscriptionsTool,
        getCustomerLogsTool,
        listCustomerAddressesTool,
        getCustomerAddressTool,
        createCustomerAddressTool,
        updateCustomerAddressTool,
        deleteCustomerAddressTool,
        listCustomerPaymentMethodsTool,
        getCustomerPaymentMethodTool,
        createCustomerPaymentMethodTool,
        updateCustomerPaymentMethodTool,
        deleteCustomerPaymentMethodTool,
        listCustomerChargesCreditsTool,
        createCustomerChargeCreditTool,
        deleteCustomerChargeCreditTool,
      ];
  • Service function that performs the actual HTTP GET request to /customers/{customerId}/invoices with query parameters for filtering and pagination.
    export async function getCustomerInvoices(
      client: Client,
      customerId: string,
      params?: CustomerInvoiceListParams
    ): Promise<PaginatedResponse<Invoice>> {
      const search = new URLSearchParams();
      if (params) appendParams(search, params as Record<string, unknown>);
      if (params?.status) search.append("status", params.status);
      if (params?.dateFrom) search.append("dateFrom", params.dateFrom);
      if (params?.dateTo) search.append("dateTo", params.dateTo);
      if (params?.subscriptionId) search.append("subscriptionId", params.subscriptionId);
      return client.get<PaginatedResponse<Invoice>>(
        `/customers/${customerId}/invoices${queryString(search)}`
      );
    }
Behavior4/5

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

Without annotations, the description discloses that this is a read-only GET operation with pagination and filtering capabilities. It lists all parameters but does not cover return structure, auth requirements, or rate limits. However, for a read list operation, the provided detail is adequate.

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 extremely concise: a single sentence with core purpose followed by a compact list of parameter capabilities. No unnecessary words; all information is relevant and front-loaded.

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 no output schema and moderate complexity, the description covers the endpoint, all parameters with examples, and pagination/filtering. It omits response structure and error handling, but for a list tool with rich schema descriptions, this is largely sufficient.

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?

The description adds value beyond the schema by summarizing key parameters and giving examples (e.g., include: 'detail, transactions', status enum values). Since schema coverage is 100%, the description enhances understanding of parameter usage and options.

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 verb 'List' and the resource 'invoices for a customer', specifying the HTTP endpoint. It distinguishes from sibling tools like list_invoices (global scope) and get_invoice (single invoice) by focusing on per-customer listing.

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?

The description implies use when needing invoices for a specific customer with filtering options, but does not explicitly state when to use alternatives or when not to use this tool. No comparison with similar tools like get_customer_unpaid_invoices is provided.

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