Skip to content

sessions_list_purchases

Passes, memberships and credits the viewer already holds.

Viewerread-onlysign-in required

When to use it

  • When the person asks how many classes they have left.

  • To find a pass id to hand to sessions_preview_checkout, which is how an agent discovers a booking would cost nothing.

Parameters

This tool takes no arguments.

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.

One line per pass, membership or gift-card balance the viewer holds *with this business*: name, id, sessions remaining, balance, and expiry.

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_list_purchases',
);

const result = await document.modelContext
  .executeTool(tool);
content
1 thing(s) you hold here. Pass an id as the
`pass` argument to sessions_preview_checkout…
- 10-Class Pass [<id>] · 6 session(s) left
  · expires 2027-01-15
structuredContent
{
  "purchases": [
    {
      "id": "<id>",
      "sessionsRemaining": 6,
      "expiresAt": "2027-01-15",
      "product": {
        "__typename": "Pass",
        "name": "10-Class Pass"
      }
    }
  ],
  "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_list_purchases
Passes, class packs, memberships and gift-card balances the signed-in viewer holds with this business, with credits remaining and expiry. Use the ids here as the pass argument to sessions_preview_checkout to find out whether a booking would cost anything.

See also