Skip to main content
Glama

list_invoices

Retrieve a list of invoices with optional filters like status, query, or include details, transactions, billruns. Supports pagination and sorting.

Instructions

List invoices. GET /invoices. Optional: include (detail, transactions, billruns, externalInvoices), status, query, orderBy, sortBy, filterId, itemPerPage, pageNo.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
includeNoComma-separated: detail, transactions, billruns, externalInvoices
statusNoFilter by status
queryNoSearch query
orderByNoSort column
sortByNoSort direction
filterIdNoFilter ID
itemPerPageNoItems per page
pageNoNoPage number

Implementation Reference

  • The handler function that executes the list_invoices tool logic. It parses args with Zod schema, validates them, then calls invoiceService.listInvoices.
    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(() => invoiceService.listInvoices(client, parsed.data));
    }
  • Zod schema for list_invoices input validation: include, status, query, orderBy, sortBy, filterId, itemPerPage, pageNo (all optional).
    const schema = z.object({
      include: z.string().optional(),
      status: z.string().optional(),
      query: z.string().optional(),
      orderBy: z.string().optional(),
      sortBy: z.string().optional(),
      filterId: z.number().int().optional(),
      itemPerPage: z.number().int().min(1).optional(),
      pageNo: z.number().int().min(1).optional(),
    });
  • MCP input schema definition for list_invoices with name, description, and JSON Schema properties (object type with optional fields).
    const definition = {
      name: "list_invoices",
      description:
        "List invoices. GET /invoices. Optional: include (detail, transactions, billruns, externalInvoices), status, query, orderBy, sortBy, filterId, itemPerPage, pageNo.",
      inputSchema: {
        type: "object" as const,
        properties: {
          include: { type: "string", description: "Comma-separated: detail, transactions, billruns, externalInvoices" },
          status: { type: "string", description: "Filter by status" },
          query: { type: "string", description: "Search query" },
          orderBy: { type: "string", description: "Sort column" },
          sortBy: { type: "string", description: "Sort direction" },
          filterId: { type: "number", description: "Filter ID" },
          itemPerPage: { type: "number", description: "Items per page" },
          pageNo: { type: "number", description: "Page number" },
        },
        required: [],
      },
    };
  • Core service function that performs the actual HTTP GET /invoices request with query parameters built from the ListInvoicesParams.
    export async function listInvoices(
      client: Client,
      params?: ListInvoicesParams
    ): Promise<PaginatedResponse<unknown>> {
      const search = new URLSearchParams();
      if (params?.include) search.append("include", params.include);
      if (params?.status) search.append("status", params.status);
      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?.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>>(`/invoices${q ? `?${q}` : ""}`);
    }
  • Registration: listInvoicesTool is exported by registerInvoiceTools() as one of 8 invoice tools.
    export function registerInvoiceTools(): Tool[] {
      return [
        listInvoicesTool,
        getInvoiceTool,
        createInvoiceTool,
        updateInvoiceTool,
        deleteInvoiceTool,
        chargeInvoiceTool,
        chargeInvoiceExternalTool,
        voidInvoiceTool,
      ];
    }
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It lists optional parameters but does not disclose scope (e.g., all invoices across all customers), pagination behavior, or authentication requirements. The description adds only minimal behavioral insight.

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?

The description is short and front-loads the purpose. It could be slightly more informative without becoming verbose, but it efficiently conveys the core action.

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?

No output schema, no annotations, and the description fails to explain the response format, pagination details, or the scope of invoices returned. Given 8 parameters, the description is incomplete for an AI agent to fully understand the tool's behavior.

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% and each parameter has a clear description. The description merely restates the parameters with slight formatting (e.g., listing include options), adding no new semantic value beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it lists invoices and includes the HTTP method. However, it does not differentiate from sibling tools like get_customer_invoices or list_external_invoices, which could cause confusion.

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

Usage Guidelines2/5

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

No guidance on when to use this tool versus alternatives. There are multiple invoice-related list tools, but no conditions, exclusions, or recommendations are 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