sessions_preview_checkout
Real totals for a booking — subtotal, discount, tax, credit, amount due.
When to use it
Before the agent quotes any figure — this is the only tool that returns real money.
Always before
sessions_book_session: an amount due of zero is what makes that tool usable at all.To test whether a discount code, gift card, or an entitlement the person holds actually covers a session. The
passargument is an entitlement id fromsessions_list_purchases; when it settles nothing, the result says so rather than quietly quoting the full price.
Parameters
sessionstringrequiredThe scheduled session id, as returned by sessions_list_schedule. Pass it through verbatim — it is an opaque global id, not a number.
ticketsarrayoptionalFor a session that sells named admission bands ("Adult", "Child"), how many of each. One booking is written for the whole party. Price ids come from prices on sessions_get_session. Omit for a session that sells one undifferentiated spot.
discountCodestringoptionalDiscount code to apply.
giftCardCodestringoptionalGift-card code to apply.
passstringoptionalId of a pass or membership the viewer holds, to cover the seat. From sessions_list_purchases.
Returns
Every tool returns two things: text for the model to read, and a structuredContent object beside it for code that would rather branch on a field.
The full breakdown — subtotal, discount, any pass or membership credit, tax, gift-card credit, total, and amount due — plus an explicit line saying whether the booking can be completed by an agent or has to go to the sheet. Priced by previewCheckout against the very same basket the booking mutation takes, so the quote and the charge cannot disagree.
Example
Run this from any agent or script executing in the page.
const tools =
await document.modelContext.getTools();
const tool = tools.find(
(t) => t.name === 'sessions_preview_checkout',
);
const result = await document.modelContext
.executeTool(tool, {
"session": "<session id>",
"pass": "<pass id>"
});Subtotal: 24.00 CAD
Covered by a pass or membership: -24.00 CAD
Tax: 0.00 CAD
Total: 0.00 CAD
Amount due: 0.00 CAD
Nothing is owed, so sessions_book_session
can book this outright.{
"quote": {
"subtotal": 2400,
"discountTotal": 0,
"taxTotal": 0,
"tipTotal": 0,
"total": 0,
"giftCardCredit": 0,
"entitlementCredit": 2400,
"amountDue": 0,
"taxCalculationId": null,
"errors": []
},
"currency": "cad"
}What the agent is told
The description the model reads when deciding whether to call this. It is the only thing that decides whether the tool fires at the right moment, so it is worth knowing what it says.