cancel_standing_order
Status: Implemented | Module: trip
Cancel a standing order (recurring trip schedule). Implements the same single-tool two-step pattern as cancel_trip: omit reason to fetch the available reasons; pass reason to fuzzy-match and cancel. Cancels all FUTURE trips in the standing order — already-created trips from the order are not automatically cancelled.
Two-Step Flow
Section titled “Two-Step Flow”Step 1: Fetch reasons
Section titled “Step 1: Fetch reasons”Call cancel_standing_order WITHOUT reason. The use case fetches the available cancellation reasons and returns them in available_reasons. No cancellation is performed.
Step 2: Cancel with chosen reason
Section titled “Step 2: Cancel with chosen reason”Call again WITH reason set to the chosen reason name OR reason_id. Same matcher as cancel_trip (case-insensitive id → exact name → substring → UUID/numeric pass-through). Some reasons require an additional reason_description.
Annotations
Section titled “Annotations”| Hint | Value |
|---|---|
| readOnlyHint | false |
| destructiveHint | true |
| idempotentHint | false |
| Field | Type | Required | Description |
|---|---|---|---|
session_id |
string | yes | Active session |
order_id |
string | yes | Standing order UUID from get_standing_orders |
reason |
string | no | Reason name OR reason_id. Omit to fetch the list of available reasons. |
reason_description |
string | no | Free-text explanation. Required when the matched reason has description_required: true. |
Output
Section titled “Output”The output is a discriminated wrapper — exactly one of the two shapes below is populated.
When reason is omitted (Step 1)
Section titled “When reason is omitted (Step 1)”| Field | Type | Description |
|---|---|---|
status |
string | success |
available_reasons |
CancellationReason[] | Available reasons (reason_id, name, description_required) |
message |
string | Pick-one prompt |
When reason is supplied (Step 2)
Section titled “When reason is supplied (Step 2)”| Field | Type | Description |
|---|---|---|
status |
string | success |
order_id |
string | Cancelled order UUID |
message |
string | Confirmation message |
Example: Step 1 (fetch reasons)
Section titled “Example: Step 1 (fetch reasons)”{ "params": { "name": "cancel_standing_order", "arguments": { "session_id": "a1b2c3d4-...", "order_id": "so-uuid-001" } }}Example: Step 2 (cancel)
Section titled “Example: Step 2 (cancel)”{ "params": { "name": "cancel_standing_order", "arguments": { "session_id": "a1b2c3d4-...", "order_id": "so-uuid-001", "reason": "Treatment completed" } }}Related
Section titled “Related”- Standing Orders Flow
- Source:
internal/app/trip/usecases/cancel_standing_order.go - Prerequisite: get_standing_orders
- Companion: cancel_trip (same two-step pattern for single trips)