Calculate Document Totals
calculate_totalsCompute subtotal, tax, discount, grand total, and balance due from document items. Stateless.
Example tool call
This call uses example arguments supplied in the tool’s input schema.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"document": {
"items": [
{
"quantity": 2,
"unit_price": 50,
"description": "Service"
}
]
}
},
"name": "calculate_totals"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| document | Yes | Document JSON with items, tax_rate, discount_amount, and optional amount_paid. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| is_paid | Yes | True when paid in full. | |
| subtotal | Yes | Subtotal before tax/discount. | |
| tax_total | Yes | Tax amount. | |
| amount_paid | Yes | Amount paid. | |
| balance_due | Yes | Remaining balance due. | |
| grand_total | Yes | Payable grand total. | |
| discount_amount | Yes | Discount applied. |