Skip to content

sessions_preview_checkout

Real totals for a booking — subtotal, discount, tax, credit, amount due.

Discoveryread-only

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 a pass the person holds actually covers a session.

Parameters

sessionstringrequired

The scheduled session id, as returned by sessions_list_schedule. Pass it through verbatim — it is an opaque global id, not a number.

discountCodestringoptional

Discount code to apply.

giftCardCodestringoptional

Gift-card code to apply.

passstringoptional

Id 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, 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.

Example

Run this from any agent or script executing in the page.

javascript
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>"
  });
content
Subtotal: 24.00 CAD
Tax: 0.00 CAD
Total: 24.00 CAD
Amount due: 0.00 CAD
Nothing is owed, so sessions_book_session
can book this outright.
structuredContent
{
  "checkoutPreview": {
    "subtotal": 2400,
    "discountCents": 0,
    "taxCents": 0,
    "giftCardCreditCents": 0,
    "total": 2400,
    "amountDueCents": 0,
    "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.

sessions_preview_checkout
Prices a booking without committing to it: subtotal, discounts, tax, gift-card credit, total, and the amount actually due. Optionally applies a discount code, a gift-card code, or a pass the viewer already holds. Always call this before sessions_book_session — an amount due of zero is what makes that tool usable.

See also