Calculate totals
calculate_totalsCompute subtotal, discount, tax and total for a list of line items (discount applied before tax, amounts rounded to 2 dp). Use for quick totals math without building an invoice. Do NOT use to produce an invoice document; use create_invoice.
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": {
"items": "<items>"
},
"name": "calculate_totals"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| items | Yes | Line items (at least one), each {description, quantity, unit_price}; line amount = quantity x unit_price. | |
| discount_pct | No | Discount in percent of the subtotal, 0-100, e.g. 10 for 10% off. Default 0. | |
| tax_rate_pct | No | Tax rate in percent, 0-100, applied after the discount, e.g. 18 for 18% GST. Default 0. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tax | Yes | Tax amount = (subtotal - discount) x tax_rate_pct / 100. | |
| total | Yes | Final amount = subtotal - discount + tax. | |
| discount | Yes | Discount amount = subtotal x discount_pct / 100. | |
| subtotal | Yes | Sum of quantity x unit_price, rounded to 2 dp. |