Skip to main content
Glama
zenskar

Zenskar MCP Server

Official
by zenskar

generateInvoice

generateInvoice

Generates an invoice for a contract and customer over a billing window. Requires exact bill_for_date from getContractBillingCycles to match a billing cycle.

Instructions

Generate an invoice for a single contract+customer over a billing window.

Granularity is PER PHASE, NOT per product. ONE call generates ONE invoice covering ALL products active in the (contract, customer, from_date, to_date) window — every product becomes a line item on the same invoice. NEVER iterate over products.

MANDATORY PRE-STEP: call getContractBillingCycles first to fetch the list of valid {start_date, end_date, bill_for_date, billing_cycle_start_day} entries for this contract. Pick ONE entry. Copy its start_datefrom_date, end_dateto_date, bill_for_date, billing_cycle_start_day verbatim. DO NOT compute these from contract.start_date, pricing.billing_period, or human intuition — the backend matches bill_for_date exactly against the pre-computed list.

Date fields accept ISO-8601 strings (e.g. "2026-04-28T00:00:00Z") or integer UNIX seconds. Prefer pasting ISO strings verbatim from getContractBillingCycles output — the server converts to unix internally before sending to the API.

Known failure modes: • {invoice_ids: []}bill_for_date did not match any cycle. Re-fetch billingCycles and copy the exact value. • $0 invoice → bill_for_date/billing_cycle_start_day omitted entirely. • InvoiceAlreadyGeneratedForThisBillingPeriod → an approved invoice already exists for this cycle.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contract_idYesUUID of the contract to generate the invoice for.
customer_idYesUUID of the customer.
from_dateYesStart of billing period. Accepts ISO-8601 string (e.g. `2026-04-28T00:00:00Z`) or UNIX seconds integer. PREFER ISO string copied verbatim from getContractBillingCycles.start_date — avoids timezone bugs.
to_dateYesEnd of billing period. Accepts ISO-8601 string or UNIX seconds integer. PREFER ISO string copied verbatim from getContractBillingCycles.end_date.
bill_for_dateYesREQUIRED. Anchors which billing cycle this invoice belongs to. Accepts ISO-8601 string or UNIX seconds. MUST match exactly one of the `bill_for_date` values returned by getContractBillingCycles — pasting the ISO string verbatim is the safest path. Arbitrary dates produce `invoice_ids: []`.
billing_cycle_start_dayYesREQUIRED. Day of month (1-31) anchoring the recurring billing cycle. Fetch from the contract or plan's billing_period; if unsure, use the day-of-month of contract.start_date. Omitting this causes the API to return a $0 invoice because no billing cycle matches.
__userContextNoInternal user context for multi-tenant authentication and approval workflow
Behavior5/5

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

With no annotations, the description fully discloses the tool's behavior: it handles all products in the window as line items, requires exact date matching, and explains consequences of missing or incorrect parameters. No contradictions.

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?

The description is well-structured: purpose first, then granularity, mandatory pre-step, parameter details, and failure modes. Each sentence adds value; no fluff. Front-loaded critical information.

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?

Despite lacking an output schema, the description covers expected return values (invoice_ids, $0 invoice) and edge cases. With 7 parameters and complex date handling, the description provides comprehensive guidance for correct invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, but the description adds critical context beyond schema: explains why bill_for_date must match exactly, consequences of omitting billing_cycle_start_day, and date format preferences. This significantly enhances usability.

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 it generates an invoice for a single contract+customer over a billing window, with granularity per phase, not per product. It distinguishes from related tools like createInvoiceCharge by explaining its scope.

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?

Explicitly mandates calling getContractBillingCycles as a pre-step, provides detailed instructions on how to copy date fields, and lists known failure modes with actionable fixes. This guides correct usage and avoids common mistakes.

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/zenskar/mcp-zenskar'

If you have feedback or need assistance with the MCP directory API, please join our Discord server