Skip to main content
Glama

get_bill_run_invoices

Retrieve invoices associated with a specific bill run. Supports pagination to control the number of invoices returned per request.

Instructions

Get invoices for a bill run. GET /bill-run/{billRunId}/invoices. Returns paginated invoices. Optional: pageNo, itemPerPage.

Input Schema

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

Implementation Reference

  • The main handler function for the get_bill_run_invoices tool. Parses args with Zod schema, calls the service to GET /bill-run/{billRunId}/invoices, and returns results via handleToolCall.
    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 { billRunId, pageNo, itemPerPage } = parsed.data;
      return handleToolCall(() =>
        billRunService.getBillRunInvoices(client, billRunId, { pageNo, itemPerPage })
      );
    }
  • Zod validation schema for the tool inputs: billRunId (required string), pageNo (optional int), itemPerPage (optional int).
    const schema = z.object({
      billRunId: z.string().min(1, "billRunId is required"),
      pageNo: z.number().int().min(1).optional(),
      itemPerPage: z.number().int().min(1).optional(),
    });
  • Tool definition/registration: name 'get_bill_run_invoices', description, and inputSchema (JSON Schema format with required billRunId and optional pageNo/itemPerPage).
    const definition = {
      name: "get_bill_run_invoices",
      description:
        "Get invoices for a bill run. GET /bill-run/{billRunId}/invoices. Returns paginated invoices. Optional: pageNo, itemPerPage.",
      inputSchema: {
        type: "object" as const,
        properties: {
          billRunId: { type: "string", description: "Bill run ID (required)" },
          pageNo: { type: "number", description: "Page number (default: 1)" },
          itemPerPage: { type: "number", description: "Items per page (default: 25)" },
        },
        required: ["billRunId"],
      },
    };
  • Import and registration of getBillRunInvoicesTool in the bill run tools collection, exported as part of registerBillRunTools().
    import { getBillRunInvoicesTool } from "./getBillRunInvoices.js";
    import { getBillRunTool } from "./getBillRun.js";
    import { listBillRunsTool } from "./listBillRuns.js";
    import { updateBillRunTool } from "./updateBillRun.js";
    
    /** All 4 bill run tools. */
    export function registerBillRunTools(): Tool[] {
      return [
        listBillRunsTool,
        getBillRunTool,
        updateBillRunTool,
        getBillRunInvoicesTool,
      ];
    }
    
    export { listBillRunsTool } from "./listBillRuns.js";
    export { getBillRunTool } from "./getBillRun.js";
    export { updateBillRunTool } from "./updateBillRun.js";
    export { getBillRunInvoicesTool } from "./getBillRunInvoices.js";
  • The underlying service function getBillRunInvoices that executes the GET /bill-run/{billRunId}/invoices HTTP request with optional pageNo and itemPerPage query parameters.
    /** GET /bill-run/{billRunId}/invoices */
    export async function getBillRunInvoices(
      client: Client,
      billRunId: string,
      params?: BillRunInvoicesParams
    ): Promise<unknown> {
      const search = new URLSearchParams();
      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<unknown>(`/bill-run/${billRunId}/invoices${q ? `?${q}` : ""}`);
    }
Behavior3/5

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

With no annotations, the description notes pagination behavior and optional parameters, but does not disclose other behavioral traits such as error handling, ordering, or field selection. The information is adequate for a read operation.

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?

Description is three sentences with clear front-loading: purpose first, then endpoint, then behavior and params. No redundant or extraneous information.

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?

Given no output schema, the description minimally states 'Returns paginated invoices' but does not detail the invoice structure, error cases, or behavior when bill run missing. Completes the basic context for a simple list tool.

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 baseline is 3. The description mentions 'Optional: pageNo, itemPerPage', but adds no additional meaning beyond what the schema provides (defaults are already in 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 gets invoices for a specific bill run, using an explicit HTTP endpoint. It distinguishes from sibling tools like list_invoices or get_invoice by specifying the resource (bill run 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?

The description implies usage when needing invoices for a bill run, but does not provide explicit when-to-use or when-not-to-use guidance, nor mention alternatives among the many sibling list/get tools.

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