Skip to main content
Glama

charge_invoice_external

Charge an invoice via offline payment (cash/check/wire). Provide invoice ID and amount in cents.

Instructions

Charge an invoice via offline payment (cash/check/wire). POST /invoices/{invoiceId}/charge with paymentType: offlinePaymentProvider. AMOUNT IN CENTS: e.g. 5500 = $55.00. Required: invoiceId, amount (integer cents).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
invoiceIdYesInvoice ID (required)
amountYesAmount in CENTS (e.g. 5500 = $55.00). Integer, required.

Implementation Reference

  • Handler function that validates args via Zod schema and delegates to invoiceService.chargeInvoiceExternal with invoiceId and amount.
    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, amount } = parsed.data;
      return handleToolCall(() =>
        invoiceService.chargeInvoiceExternal(client, invoiceId, { amount })
      );
    }
  • Core service function that POSTs to /invoices/{invoiceId}/charge with paymentType: offlinePaymentProvider, enabling offline/cash/check/wire charging.
    export async function chargeInvoiceExternal(
      client: Client,
      invoiceId: string,
      body: Omit<ChargeInvoiceBody, "paymentType">
    ): Promise<unknown> {
      return client.post<unknown>(`/invoices/${invoiceId}/charge`, {
        ...body,
        paymentType: "offlinePaymentProvider",
      });
    }
  • Zod validation schema requiring invoiceId (string) and amount (positive integer in CENTS).
    const schema = z.object({
      invoiceId: z.string().min(1, "invoiceId is required"),
      amount: z.number().int().min(1, "amount is required and must be positive (in CENTS)"),
    });
  • Tool definition including name 'charge_invoice_external', description, and JSON Schema input schema.
    const definition = {
      name: "charge_invoice_external",
      description:
        "Charge an invoice via offline payment (cash/check/wire). POST /invoices/{invoiceId}/charge with paymentType: offlinePaymentProvider. AMOUNT IN CENTS: e.g. 5500 = $55.00. Required: invoiceId, amount (integer cents).",
      inputSchema: {
        type: "object" as const,
        properties: {
          invoiceId: { type: "string", description: "Invoice ID (required)" },
          amount: {
            type: "number",
            description: "Amount in CENTS (e.g. 5500 = $55.00). Integer, required.",
          },
        },
        required: ["invoiceId", "amount"],
      },
    };
  • Re-export of chargeInvoiceExternalTool from the centralized invoice tools barrel module, making it available for registration.
    export { chargeInvoiceExternalTool } from "./chargeInvoiceExternal.js";
    export { voidInvoiceTool } from "./voidInvoice.js";
Behavior3/5

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

Discloses the action and requirements, but does not detail side effects, idempotency, or error conditions. No annotations provided. Adequate but not thorough.

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?

Three sentences, front-loaded with purpose. No redundant or unnecessary information.

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?

Covers core functionality and parameter details. No output schema, but with simple inputs and no nested objects, description is sufficiently complete.

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?

Adds value beyond schema by explaining amount is in cents with an example. Schema already covers parameter basics.

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?

Clearly states it charges an invoice via offline payment (cash/check/wire). Distinguishes from sibling charge_invoice which likely handles online payments.

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?

Implies use for offline payments. Does not explicitly exclude online payments or mention alternatives, but sibling tool name provides implicit distinction.

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