Skip to main content
Glama

get_invoice

Retrieve a specific invoice by its ID, with optional details like line items or transactions.

Instructions

Get an invoice by ID. GET /invoices/{invoiceId}. Optional: include.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
invoiceIdYesInvoice ID (required)
includeNoAttributes to include (e.g. detail, transactions)

Implementation Reference

  • Handler function for get_invoice tool: validates args with Zod schema, then calls invoiceService.getInvoice(client, invoiceId, { include }) via handleToolCall wrapper.
    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 { invoiceId, include } = parsed.data;
      return handleToolCall(() => invoiceService.getInvoice(client, invoiceId, { include }));
    }
    
    export const getInvoiceTool: Tool = {
      definition,
      handler,
    };
  • Zod input schema for get_invoice: requires invoiceId (string), optional include (string).
    const schema = z.object({
      invoiceId: z.string().min(1, "invoiceId is required"),
      include: z.string().optional(),
    });
  • Tool definition (name: 'get_invoice', description, inputSchema with properties invoiceId and include).
    const definition = {
      name: "get_invoice",
      description: "Get an invoice by ID. GET /invoices/{invoiceId}. Optional: include.",
      inputSchema: {
        type: "object" as const,
        properties: {
          invoiceId: { type: "string", description: "Invoice ID (required)" },
          include: { type: "string", description: "Attributes to include (e.g. detail, transactions)" },
        },
        required: ["invoiceId"],
      },
    };
  • Service-layer getInvoice function: builds URL with optional include param and calls client.get on /invoices/{invoiceId}.
    export async function getInvoice(
      client: Client,
      invoiceId: string,
      params?: { include?: string }
    ): Promise<unknown> {
      const search = new URLSearchParams();
      if (params?.include) search.append("include", params.include);
      const q = search.toString();
      return client.get<unknown>(`/invoices/${invoiceId}${q ? `?${q}` : ""}`);
    }
  • Registration: getInvoiceTool is included in the array returned by registerInvoiceTools(), which is consumed by src/tools/index.ts to build the global tool registry.
    export function registerInvoiceTools(): Tool[] {
      return [
        listInvoicesTool,
        getInvoiceTool,
        createInvoiceTool,
        updateInvoiceTool,
        deleteInvoiceTool,
        chargeInvoiceTool,
        chargeInvoiceExternalTool,
        voidInvoiceTool,
      ];
    }
Behavior2/5

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

No annotations are present, and the description does not disclose behavioral traits like read-only nature, authentication requirements, error handling (e.g., if invoice not found), or rate limits. The tool is a simple GET, but transparency is minimal.

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 concise at two sentences, front-loading the essential purpose. However, it could be slightly more informative without becoming verbose, such as clarifying the purpose of 'include'.

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 the simplicity of the tool and the rich sibling context, the description is adequate but incomplete. It does not mention output format, potential errors, or prerequisites, which would be helpful given the absence of annotations and output schema.

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 description adds no new meaning beyond the schema for 'invoiceId' (required) and 'include' (optional). The description merely repeats the field names without elaborating on usage or examples, providing baseline value.

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 action (Get), resource (invoice by ID), and includes the HTTP endpoint. It distinguishes from sibling tools like get_customer_invoices or list_invoices by specifying retrieval via ID.

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 is provided on when to use this tool versus alternatives such as get_customer_invoices or list_invoices. The description does not include context like when a single invoice fetch is appropriate.

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