Cancellation Flow
Sequence
Section titled “Sequence”verify_member --> get_active_trips --> cancel_trip(trip_id) # Step 1: returns available reasons --> [present reasons to member] --> cancel_trip(trip_id, reason) # Step 2: fuzzy-match + cancelcancel_trip is now a single-tool two-step pattern. The separate get_cancellation_reasons tool was removed in v2.0 — fetching the reasons IS the first call to cancel_trip (the no-reason variant). This halves the round-trip count and removes a stale read tool that always paired 1:1 with cancel_trip anyway.
Step-by-Step
Section titled “Step-by-Step”Step 1: verify_member
Section titled “Step 1: verify_member”Establish a session for the member. Same as the booking flow.
Step 2: get_active_trips
Section titled “Step 2: get_active_trips”List the member’s active trips to find the trip to cancel.
- Input:
session_id - Output:
trips[]withtrip_id,confirmation_number,status, addresses, times
Step 3: cancel_trip (no reason — fetch reasons)
Section titled “Step 3: cancel_trip (no reason — fetch reasons)”Call cancel_trip WITHOUT a reason arg. The use case fetches the available reasons for THIS specific trip and returns them. No cancellation is performed.
- Input:
session_id,trip_id - Output:
available_reasons[]withreason_id(UUID),name,description_required(boolean)
Step 4: Present to Member
Section titled “Step 4: Present to Member”Show the reasons to the member; let them choose. Conversational step, handled by the AI agent.
Step 5: cancel_trip (with reason — cancel)
Section titled “Step 5: cancel_trip (with reason — cancel)”Call cancel_trip again WITH the chosen reason.
- Input:
session_id,trip_id,reason(the chosen reason name OR itsreason_idUUID) - Optional:
reason_description— required when the matched reason carriesdescription_required: true - Matcher order: case-insensitive id → exact case-insensitive name → bidirectional substring (single hit) → UUID/numeric pass-through
- Uses the Customer initiator (member-facing reasons)
Cancelling a Standing Order
Section titled “Cancelling a Standing Order”cancel_standing_order follows the same two-step pattern: omit reason to fetch, pass reason to cancel.
Error Scenarios
Section titled “Error Scenarios”| Error | Recovery |
|---|---|
NO_SESSION |
Call verify_member first |
| No active trips | Inform member they have no trips to cancel |
MISSING_PREREQUISITE (could not match cancellation reason) |
Re-call without reason to see the available list, then re-call with one of those names |
MISSING_PREREQUISITE (ambiguous match) |
The supplied substring matched multiple reasons; pick a more specific name or pass the reason_id |
MISSING_PREREQUISITE (requires a reason_description) |
Re-call with reason_description set |