sessions_cancel_booking
Previews the refund outcome, then cancels on a second, confirmed call.
When to use it
First without
confirm, to find out what cancelling would refund under your cancellation policy.Then with
confirm: true, once the person has seen that outcome and agreed to it.
Parameters
bookingstringrequiredBooking id, as returned by sessions_list_bookings.
confirmbooleanoptionalOmit or false to preview. True only after the person has seen the refund outcome and agreed to it.
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.
Without confirm: whether the cancellation falls inside the policy’s refund window, the amount coming back, any fee withheld, and whether pass credits are forfeited or restored — and nothing is cancelled. With confirm: true: the same outcome, having actually cancelled, plus the refund that was issued. Takes a booking id from sessions_list_bookings.
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_cancel_booking',
);
const result = await document.modelContext
.executeTool(tool, {
"booking": "<booking id>",
"confirm": false
});Nothing has been cancelled. Here is what
cancelling Morning Yoga would do right now:
Inside the refund window under the policy in
force.
Money back: 24.00 CAD
Any pass or membership credit spent on it
comes back.{
"cancelled": false,
"cancellationPreview": {
"refundAmount": 2400,
"penaltyAmount": 0,
"forfeitedCredits": 0,
"withinWindow": true
}
}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.
confirm, it returns what cancelling would do under this business’s policy right now — the refund amount, any fee withheld, whether a pass credit comes back. Relay that to the person and get their agreement. Only then call again with confirm: true to actually cancel. Never pass confirm: true on the first call.