Skip to main content
Glama

get_customer_unpaid_invoices

Retrieve unpaid invoices for a customer. Supports pagination to handle large numbers of invoices.

Instructions

List unpaid invoices for a customer. GET /customers/{customerId}/invoices/unpaid. Supports pagination (pageNo, itemPerPage).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
customerIdYesCustomer ID (required)
pageNoNoPage number (default: 1)
itemPerPageNoItems per page (default: 25)

Implementation Reference

  • The handler function that validates args via Zod schema, extracts customerId/pageNo/itemPerPage, and delegates to customerService.getCustomerUnpaidInvoices.
    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 } = parsed.data;
      return handleToolCall(() =>
        customerService.getCustomerUnpaidInvoices(client, customerId, {
          pageNo,
          itemPerPage,
        })
      );
    }
  • Zod schema defining input validation: customerId (required string), pageNo (optional number), itemPerPage (optional number).
    const schema = z.object({
      customerId: z.string().min(1, "customerId is required"),
      pageNo: z.number().optional(),
      itemPerPage: z.number().optional(),
    });
  • MCP definition with name 'get_customer_unpaid_invoices', description, and inputSchema (JSON Schema format) for the tool.
    const definition = {
      name: "get_customer_unpaid_invoices",
      description:
        "List unpaid invoices for a customer. GET /customers/{customerId}/invoices/unpaid. Supports pagination (pageNo, itemPerPage).",
      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)" },
        },
        required: ["customerId"],
      },
    };
  • Tool registered in the customer tools array (registerCustomerTools) at index position.
    getCustomerUnpaidInvoicesTool,
  • The service function that makes the actual HTTP GET request to /customers/{customerId}/invoices/unpaid with optional pagination params.
    export async function getCustomerUnpaidInvoices(
      client: Client,
      customerId: string,
      params?: Pick<PaginationIncludeParams, "pageNo" | "itemPerPage">
    ): Promise<PaginatedResponse<Invoice>> {
      const search = new URLSearchParams();
      if (params?.pageNo != null) search.append("pageNo", String(params.pageNo));
      if (params?.itemPerPage != null) search.append("itemPerPage", String(params.itemPerPage));
      return client.get<PaginatedResponse<Invoice>>(
        `/customers/${customerId}/invoices/unpaid${queryString(search)}`
      );
    }
Behavior4/5

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

With no annotations, the description carries the full burden. It discloses the tool is a read-only GET operation, lists unpaid invoices, and supports pagination. This is sufficient for basic behavioral understanding. It does not address rate limits or auth, but for a simple list operation, this 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: two sentences front-load the purpose and HTTP method, then list key parameters. Every word is useful; there is no redundancy or extra fluff. Perfectly sized for quick comprehension.

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 the simplicity of the tool (list with pagination) and full schema coverage, the description is mostly complete. It lacks an explicit statement about the return format (e.g., array of invoice objects), but this is typical and can be inferred. For a tool with no output schema, describing the expected output would enhance completeness slightly.

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?

The input schema already provides 100% description coverage for all three parameters. The description reiterates pagination support but does not add new meaning beyond what the schema offers. Baseline score of 3 is appropriate as the schema already does the heavy lifting.

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 unpaid invoices for a customer, with a specific verb 'List' and resource 'unpaid invoices'. It also includes the HTTP path, which is extra context. The purpose is unambiguous and distinguishes it from sibling tools like get_customer_invoices or list_invoices by specifying the 'unpaid' filter.

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 provides clear context for when to use this tool: when you need unpaid invoices for a specific customer. It mentions pagination, giving guidance on using pageNo and itemPerPage. However, it does not explicitly exclude alternatives or mention when not to use it, but the sibling context makes it clear.

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