Skip to main content
Glama

prepare_client_invoice

Prepare a client invoice from a saved ExpenseBot report without creating it. Reads canonical report rows, allocates a unique invoice number, verifies the client ledger identity and advance, and returns exact totals plus a short-lived preparationId. Call this first, show the preview to the user, then call create_client_invoice after explicit confirmation. It reserves the invoice number and preview for 30 minutes but creates no invoice, document, Income row, email, or payment.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "reportId": "<reportId>",
      "clientName": "<clientName>",
      "issueDate": "<issueDate>"
    },
    "name": "prepare_client_invoice"
  }
}

Input Schema

NameRequiredDescriptionDefault
taxPctNoTax percentage applied after markup and custom line items; use 0 for no tax.
reportIdYesSaved ExpenseBot report ID to invoice.
taxLabelNoTax label such as HST, GST, or VAT.
issueDateYesCalendar-valid invoice date in YYYY-MM-DD format.
markupPctNoMarkup applied only to rebilled expense rows.
clientNameYesFull client or business name shown on the invoice.
receiptIdsNoOptional exact report receipt IDs. Defaults to every current report expense.
billToEmailNoOptional client email printed on the invoice. This does not send email.
paymentTermsNoInvoice due terms. Defaults to the client's billing profile or net30.
clientAddressNoOptional billing address printed in the invoice's Bill To section.
invoiceNumberNoOptional custom invoice number. ExpenseBot allocates one when omitted.
advanceAppliedNoVerified client advance to apply against this invoice.
customLineItemsNoOptional fee/service lines. They are taxed but never marked up.
mentionSupportingReceiptsNoWhen true, note on the invoice that supporting receipts are available.

Output Schema

NameRequiredDescriptionDefault
previewYes
successYes
expiresAtYes
preparationIdYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changed
    • removedOutput schema / properties / expiresAt / format
      Removed value: -"date-time"
    • removedOutput schema / properties / preview / additionalProperties
      Removed value: -true
    • removedOutput schema / properties / preview / properties
      Removed value: -{
      -  "advanceApplied": {
      -    "type": "number"
      -  },
      -  "balanceDue": {
      -    "type": "number"
      -  },
      -  "clientName": {
      -    "type": "string"
      -  },
      -  "clientTag": {
      -    "type": "string"
      -  },
      -  "currency": {
      -    "type": "string"
      -  },
      -  "customLineCount": {
      -    "minimum": 0,
      -    "type": "integer"
      -  },
      -  "dueDate": {
      -    "format": "date",
      -    "type": "string"
      -  },
      -  "expenseCount": {
      -    "minimum": 0,
      -    "type": "integer"
      -  },
      -  "grandTotal": {
      -    "type": "number"
      -  },
      -  "hasTaxRegistration": {
      -    "type": "boolean"
      -  },
      -  "invoiceNumber": {
      -    "type": "string"
      -  },
      -  "issueDate": {
      -    "format": "date",
      -    "type": "string"
      -  },
      -  "markupAmount": {
      -    "type": "number"
      -  },
      -  "markupPct": {
      -    "type": "number"
      -  },
      -  "paymentTerms": {
      -    "type": "string"
      -  },
      -  "reportId": {
      -    "type": "string"
      -  },
      -  "reportTitle": {
      -    "type": "string"
      -  },
      -  "subtotal": {
      -    "type": "number"
      -  },
      -  "taxAmount": {
      -    "type": "number"
      -  },
      -  "taxConfirmationRequired": {
      -    "type": "boolean"
      -  },
      -  "taxLabel": {
      -    "type": "string"
      -  },
      -  "taxPct": {
      -    "type": "number"
      -  }
      -}
  2. Changed1 schema field changed
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "additionalProperties": true,
      +  "properties": {
      +    "expiresAt": {
      +      "format": "date-time",
      +      "type": "string"
      +    },
      +    "preparationId": {
      +      "type": "string"
      +    },
      +    "preview": {
      +      "additionalProperties": true,
      +      "properties": {
      +        "advanceApplied": {
      +          "type": "number"
      +        },
      +        "balanceDue": {
      +          "type": "number"
      +        },
      +        "clientName": {
      +          "type": "string"
      +        },
      +        "clientTag": {
      +          "type": "string"
      +        },
      +        "currency": {
      +          "type": "string"
      +        },
      +        "customLineCount": {
      +          "minimum": 0,
      +          "type": "integer"
      +        },
      +        "dueDate": {
      +          "format": "date",
      +          "type": "string"
      +        },
      +        "expenseCount": {
      +          "minimum": 0,
      +          "type": "integer"
      +        },
      +        "grandTotal": {
      +          "type": "number"
      +        },
      +        "hasTaxRegistration": {
      +          "type": "boolean"
      +        },
      +        "invoiceNumber": {
      +          "type": "string"
      +        },
      +        "issueDate": {
      +          "format": "date",
      +          "type": "string"
      +        },
      +        "markupAmount": {
      +          "type": "number"
      +        },
      +        "markupPct": {
      +          "type": "number"
      +        },
      +        "paymentTerms": {
      +          "type": "string"
      +        },
      +        "reportId": {
      +          "type": "string"
      +        },
      +        "reportTitle": {
      +          "type": "string"
      +        },
      +        "subtotal": {
      +          "type": "number"
      +        },
      +        "taxAmount": {
      +          "type": "number"
      +        },
      +        "taxConfirmationRequired": {
      +          "type": "boolean"
      +        },
      +        "taxLabel": {
      +          "type": "string"
      +        },
      +        "taxPct": {
      +          "type": "number"
      +        }
      +      },
      +      "type": "object"
      +    },
      +    "success": {
      +      "type": "boolean"
      +    }
      +  },
      +  "required": [
      +    "success",
      +    "preparationId",
      +    "expiresAt",
      +    "preview"
      +  ],
      +  "type": "object"
      +}
  3. Changed1 schema field changed
    • changedOutput schema / (root)
      Previous value: -{
      -  "additionalProperties": true,
      -  "description": "Standard ExpenseBot tool result envelope. `message` is the human-readable summary the AI cites; `data` is the structured payload (totals, breakdowns, ids, etc.). On failure, `success` is false and `error` carries a code/message/hint triple.",
      -  "properties": {
      -    "data": {
      -      "additionalProperties": true,
      -      "description": "Structured payload. Shape varies per tool — common keys: total, breakdown, comparison, sampleMeta, ids, expenseId, reportId, signupUrl, results.",
      -      "type": "object"
      -    },
      -    "error": {
      -      "additionalProperties": true,
      -      "description": "Present only when success === false.",
      -      "properties": {
      -        "code": {
      -          "type": "string"
      -        },
      -        "hint": {
      -          "type": "string"
      -        },
      -        "message": {
      -          "type": "string"
      -        }
      -      },
      -      "type": "object"
      -    },
      -    "message": {
      -      "description": "Human-readable result text. Always present on success; prefer rendering this verbatim before any further reasoning.",
      -      "type": "string"
      -    },
      -    "sampleMeta": {
      -      "additionalProperties": true,
      -      "description": "Set when the underlying dataset was truncated. isTruncated=true means the agent saw a sample of `sampleCount` of `totalCount` rows; aggregate totals are still accurate.",
      -      "properties": {
      -        "isTruncated": {
      -          "type": "boolean"
      -        },
      -        "sampleCount": {
      -          "type": "integer"
      -        },
      -        "totalCount": {
      -          "type": "integer"
      -        }
      -      },
      -      "type": "object"
      -    },
      -    "success": {
      -      "description": "False on tool errors; check before reading `data`.",
      -      "type": "boolean"
      -    }
      -  },
      -  "type": "object"
      -}New value: +null
  4. Changed6 schema fields changed
    • addedInput schema / properties / clientAddress / description
      Added value: +"Optional billing address printed in the invoice's Bill To section."
    • addedInput schema / properties / customLineItems / items / properties / amount / description
      Added value: +"Positive amount for this fee or service line in the invoice currency."
    • addedInput schema / properties / customLineItems / items / properties / description / description
      Added value: +"User-approved fee or service description shown on the invoice."
    • addedInput schema / properties / mentionSupportingReceipts / description
      Added value: +"When true, note on the invoice that supporting receipts are available."
    • addedInput schema / properties / paymentTerms / description
      Added value: +"Invoice due terms. Defaults to the client's billing profile or net30."
    • addedInput schema / properties / taxPct / description
      Added value: +"Tax percentage applied after markup and custom line items; use 0 for no tax."
  5. Changed1 schema field changed
    • addedInput schema / properties / issueDate / format
      Added value: +"date"
  6. Added

TDQS

A4.9/5.0
Behavior5/5

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

Beyond the annotations, the description discloses the reservation semantics (invoice number and preview held for 30 minutes), an enumerated list of side effects that do NOT occur (no invoice, document, Income row, email, or payment), and the short-lived preparationId contract. This explains why readOnlyHint=false despite no invoice being created, so the behavior is coherent rather than contradictory.

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, then workflow, then side-effect boundaries. Every clause carries distinct information; the negation list is compact and eliminates the most likely agent misconceptions in one stroke.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 14-parameter preparation tool with an output schema already documenting the returned totals and preparationId, the description supplies the remaining lifecycle context: ordering, confirmation requirement, reservation window, and the exact absence of writes. Nothing an agent needs in order to sequence this correctly is missing.

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?

Schema coverage is 100%, so the schema already carries per-parameter meaning and the baseline is 3. The description adds value on two parameters in particular: it explains that the client ledger identity and advance are verified (advanceApplied) and that a unique invoice number is allocated when omitted (invoiceNumber), which the schema states only as a default.

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 names a specific verb and resource ("Prepare a client invoice from a saved ExpenseBot report") and immediately delimits it with "without creating it," which is exactly the distinction that separates it from the sibling create_client_invoice. An agent can tell the two apart without opening either schema.

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

Usage Guidelines5/5

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

It gives an explicit ordered workflow: "Call this first, show the preview to the user, then call create_client_invoice after explicit confirmation." Both the alternative tool and the human-in-the-loop gating condition are stated, leaving nothing to inference.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.