fortrip 3.3.0 → 3.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -142,6 +142,7 @@ other command that needs to save a sign-in exits 1 too. The error says to set
|
|
|
142
142
|
| `orders get <orderId>` | Show an order and its status |
|
|
143
143
|
| `orders list` | List your orders, newest first |
|
|
144
144
|
| `orders cancel <orderId>` | Cancel an order under its terms, for the penalty the user agreed to |
|
|
145
|
+
| `orders pay <orderId>` | Pay an order with a shared payment token instead of its link |
|
|
145
146
|
| `login` | Sign in through the browser (device code) |
|
|
146
147
|
| `logout` | Revoke and forget the saved token |
|
|
147
148
|
| `whoami` | Show the signed-in account |
|
|
@@ -15074,6 +15074,16 @@ var cancelOrderInput = strictInput({
|
|
|
15074
15074
|
"The penalty the user agreed to: cancel.penalty.amount of the order, in its currency."
|
|
15075
15075
|
)
|
|
15076
15076
|
});
|
|
15077
|
+
var sharedPaymentTokenError = "sharedPaymentToken must be a Stripe shared payment token: spt_ followed by letters and digits";
|
|
15078
|
+
var payOrderInput = strictInput({
|
|
15079
|
+
orderId: orderId.describe("orderId of the order to pay, from create order or get order."),
|
|
15080
|
+
sharedPaymentToken: external_exports.string({ error: sharedPaymentTokenError }).regex(/^spt_[A-Za-z0-9]{1,250}$/, { error: sharedPaymentTokenError }).describe(
|
|
15081
|
+
"The shared payment token (spt_\u2026) the user approved for this order, requested with the order's payment.credentialLimits."
|
|
15082
|
+
),
|
|
15083
|
+
total: usdMoney.describe(
|
|
15084
|
+
"The total the user approved: the order's price.total, exactly as returned."
|
|
15085
|
+
)
|
|
15086
|
+
});
|
|
15077
15087
|
|
|
15078
15088
|
// ../contract/src/commands.ts
|
|
15079
15089
|
function fieldDescription(json2, field, sets = {}) {
|
|
@@ -15319,6 +15329,22 @@ var cancelFlags = flagsOf(cancelOrderInput, [
|
|
|
15319
15329
|
description: "The penalty the user agreed to, exactly as `orders get` shows it, in the order's currency, e.g. `12.50`. Without it, the command cancels nothing: it shows the penalty and the refund."
|
|
15320
15330
|
}
|
|
15321
15331
|
]);
|
|
15332
|
+
var payFlags = flagsOf(payOrderInput, [
|
|
15333
|
+
{
|
|
15334
|
+
flag: "token",
|
|
15335
|
+
field: "sharedPaymentToken",
|
|
15336
|
+
type: "string",
|
|
15337
|
+
placeholder: "<spt_\u2026>",
|
|
15338
|
+
description: "The shared payment token the user's wallet granted for this order, with the order's credential limits."
|
|
15339
|
+
},
|
|
15340
|
+
{
|
|
15341
|
+
flag: "total",
|
|
15342
|
+
field: "total",
|
|
15343
|
+
type: "string",
|
|
15344
|
+
placeholder: "<USD decimal>",
|
|
15345
|
+
description: "The total the user approved, exactly as `orders get` shows it, in USD, e.g. `125.00`."
|
|
15346
|
+
}
|
|
15347
|
+
]);
|
|
15322
15348
|
var BODY_OPTION = {
|
|
15323
15349
|
flag: "body",
|
|
15324
15350
|
type: "string",
|
|
@@ -15327,7 +15353,7 @@ var BODY_OPTION = {
|
|
|
15327
15353
|
};
|
|
15328
15354
|
var COMMAND_GROUPS = [
|
|
15329
15355
|
{ name: "hotels", summary: "Search hotels, get offers and order one" },
|
|
15330
|
-
{ name: "orders", summary: "Your orders, their status, and cancelling one" }
|
|
15356
|
+
{ name: "orders", summary: "Your orders, their status, paying and cancelling one" }
|
|
15331
15357
|
];
|
|
15332
15358
|
var COMMANDS = [
|
|
15333
15359
|
{
|
|
@@ -15385,6 +15411,14 @@ var COMMANDS = [
|
|
|
15385
15411
|
flags: cancelFlags,
|
|
15386
15412
|
positionals: [positional(cancelOrderInput, "orderId")]
|
|
15387
15413
|
},
|
|
15414
|
+
{
|
|
15415
|
+
group: "orders",
|
|
15416
|
+
name: "pay",
|
|
15417
|
+
summary: "Pay an order with a shared payment token instead of its link",
|
|
15418
|
+
tool: "pay_order",
|
|
15419
|
+
flags: payFlags,
|
|
15420
|
+
positionals: [positional(payOrderInput, "orderId")]
|
|
15421
|
+
},
|
|
15388
15422
|
{
|
|
15389
15423
|
group: null,
|
|
15390
15424
|
name: "login",
|
|
@@ -15461,17 +15495,17 @@ var GLOBAL_FLAGS = [
|
|
|
15461
15495
|
|
|
15462
15496
|
// ../contract/src/guide-data.generated.ts
|
|
15463
15497
|
var FRAGMENTS = {
|
|
15464
|
-
"booking": "{{#if claude-skill cli}}\n## Ordering\n\n{{/if}}\n- Call `{{tool:hotels book}}` only for the offer the user picked, with at least one guest per room{{#if claude-skill cli}}, named as the user gave them{{/if}}; never invent guests.{{#if claude-skill cli}} Room 1 is the offer's first room, and a room takes no more guests than it sleeps.{{/if}}\n- Guest names: Latin letters as on the passport (M\xFCller \u2192 Mueller), first and last name 1\u2013{{limit:guestName}} characters each{{#if cli}}, as `--guest 1:John:Smith` (room 1, first name, last name){{/if}}.\n{{#if claude-skill cli}}\n- The contact's first and last name (up to {{limit:contactFirstName}} characters each), email and phone (with its country code) are all required. Special requests must be in English and aren't guaranteed.\n{{/if}}\n- `{{tool:hotels book}}` can take
|
|
15465
|
-
"errors": "{{#if claude-skill cli}}\n## Errors\n\n{{#if claude-skill}}A tool error{{/if}}{{#if cli}}An error on stderr{{/if}} carries `code`, `message` and `retryable`, and `retryAfterSeconds` when waiting helps; many carry `details`. Search errors are under Search. Ordering errors:\n\n| `code` | Do this |\n|---|---|\n| `offer_changed` (409) | The price or terms changed since the offer: `changes` lists every change (`worse` says which are worse for the user) and `offer` is the new offer. Show the user every change and ask again; if they still want it, order the new offer, and confirm the new order before giving its link |\n| `offer_expired` (409) | Get offers again and let the user choose again |\n| `offer_unavailable` (422) | The offer is sold out or was refused: get offers again and let the user choose again |\n| `order_in_progress` (409) | The same order is still being created: wait `retryAfterSeconds`, then {{#if claude-skill}}call again with the same details{{/if}}{{#if cli}}run the command again with identical flags{{/if}} |\n| `offer_already_ordered` (409) | This offer was already ordered with other details: show that order (`orderId`) instead. An offer is ordered once |\n| `order_exists` (409) | This stay already has an order (`orderId`, `status`): show it instead of ordering again.
|
|
15498
|
+
"booking": "{{#if claude-skill cli}}\n## Ordering\n\n{{/if}}\n- Call `{{tool:hotels book}}` only for the offer the user picked, with at least one guest per room{{#if claude-skill cli}}, named as the user gave them{{/if}}; never invent guests.{{#if claude-skill cli}} Room 1 is the offer's first room, and a room takes no more guests than it sleeps.{{/if}}\n- Guest names: Latin letters as on the passport (M\xFCller \u2192 Mueller), first and last name 1\u2013{{limit:guestName}} characters each{{#if cli}}, as `--guest 1:John:Smith` (room 1, first name, last name){{/if}}.\n{{#if claude-skill cli}}\n- The contact's first and last name (up to {{limit:contactFirstName}} characters each), email and phone (with its country code) are all required. Special requests must be in English and aren't guaranteed.\n{{/if}}\n- `{{tool:hotels book}}` can take about two minutes{{#if cli}}: allow the command at least 3 minutes{{/if}}. If it times out, {{#if cli}}run it again with identical flags{{/if}}{{#if mcp claude-skill}}call it again with the same details{{/if}}: it returns the same order.\n{{#if mcp}}\n- On `offer_changed`, show the user every change and ask again before ordering the new offer.\n{{/if}}\n{{#if cli}}\n- `{{tool:hotels book}}` takes only these fields: a `--body` with any other field (such as `nationality`) is rejected with exit 2.\n{{/if}}\n",
|
|
15499
|
+
"errors": "{{#if claude-skill cli}}\n## Errors\n\n{{#if claude-skill}}A tool error{{/if}}{{#if cli}}An error on stderr{{/if}} carries `code`, `message` and `retryable`, and `retryAfterSeconds` when waiting helps; many carry `details`. Search errors are under Search. Ordering errors:\n\n| `code` | Do this |\n|---|---|\n| `offer_changed` (409) | The price or terms changed since the offer: `changes` lists every change (`worse` says which are worse for the user) and `offer` is the new offer. Show the user every change and ask again; if they still want it, order the new offer, and confirm the new order before giving its link |\n| `offer_expired` (409) | Get offers again and let the user choose again |\n| `offer_unavailable` (422) | The offer is sold out or was refused: get offers again and let the user choose again |\n| `order_in_progress` (409) | The same order is still being created: wait `retryAfterSeconds`, then {{#if claude-skill}}call again with the same details{{/if}}{{#if cli}}run the command again with identical flags{{/if}} |\n| `offer_already_ordered` (409) | This offer was already ordered with other details: show that order (`orderId`) instead. An offer is ordered once |\n| `order_exists` (409) | This stay already has an open order for one of these guests (`orderId`, `status`): show it instead of ordering again. A party with none of its guests can order the stay from a new offer (get offers again), and so can the user once the stay's order is confirmed, cancelled or refused by the hotel. It also answers when the stay's earlier order failed at the hotel with its outcome unknown, or the stay has had 20 orders; for those, the user emails {{support}} |\n| `order_attempts_exhausted` (409) | This order can't be tried again: the user emails {{support}} with its `reference` |\n| `order_removed` (410) | The order was never completed and no payment is held: get offers again and order the new offer (the order keeps its `orderId`) |\n| `stay_unsupported` (422) | `mixed_occupancy`: order once per party; `max_nights`: at most `max` nights per order |\n| `stay_in_past` (422) | Check-in has passed in the hotel's time zone: ask for new dates |\n| `ordering_paused` (503) | Ordering is paused on Fortrip's side: tell the user, and try again only after `retryAfterSeconds` (10 minutes or more) |\n\nAny code:\n\n- `invalid_request` (400): `details.issues` lists each bad field; fix them. For amenities, `details.filterable` lists those that can filter.\n- `cursor_invalid` (400): the page is gone; search again from the first page.\n- `not_found` (404): no such hotel, or no such order for this user.\n- `rate_limited` (429): wait `retryAfterSeconds`, then retry once.\n- `service_unavailable` (503) and `supplier_unavailable` (503 or 504): wait `retryAfterSeconds`, then retry once with the same details; if it fails again, tell the user.\n- Any other code: read `message`. If `retryable` is true, wait `retryAfterSeconds` and retry once; otherwise tell the user instead of guessing.\n{{/if}}\n",
|
|
15466
15500
|
"meals": '{{#if claude-skill cli}}\n## Presenting an offer\n\nGive the user, for each offer:\n\n- the room (`room.name`, beds, size) and the total, as above;\n- the meals: `meals.included` (breakfast, lunch, dinner) or `allInclusive`, with `guestsCoveredPerRoom`. Fewer than the guests per room means not everyone gets the meals (breakfast for 1 with 2 adults in the room): say who is covered. `unspecifiedMainMeals` counts main meals the hotel didn\'t name. With `known: false`, the meals are unknown: say so, and don\'t call it room only;\n- cancellation: `status` (`free`, `partial_penalty`, `non_refundable` or `unknown`), `freeCancellationEndsAt` (null with `free`: free until check-in) and the `penalties`. Times are in UTC: also give them in the hotel\'s `timeZone`;\n- confirmation: `mode` `instant` or `on_request` (within `withinMinutes`);\n- fees payable at the property (`payAtProperty.items`), in the property\'s currency. `disclosure: "incomplete"` means there can be fees not listed: say so.\n\nAn offer expires at `expiresAt`, about 30 minutes after it was made; after that, get offers again.\n\n"Not listed" is not "no": `listed: false` (amenities, policies, rooms), `null` and `unknown` mean the source didn\'t say. Tell the user it\'s unknown instead of turning it into "no".\n{{/if}}\n{{#if mcp}}\n- "Not listed" or "unknown" is not "no".\n{{/if}}\n',
|
|
15467
15501
|
"occupancy": "{{#if claude-skill cli}}\n## Rooms and guests\n\n- {{#if mcp claude-skill}}`stay.rooms` lists each room's party as `{ adults, childrenAges }`: two rooms of 2 adults, one with a child of 6, is `[{ adults: 2, childrenAges: [6] }, { adults: 2, childrenAges: [] }]`{{/if}}{{#if cli}}`--room <adults[:age,\u2026]>`, once per room, gives each room's party: two rooms of 2 adults, one with a child of 6, is `--room 2:6 --room 2`{{/if}}.\n- Ask each child's age; offers need it.\n- If the party doesn't split evenly across the rooms (3 adults in 2 rooms), ask the user how it splits.\n{{/if}}\n- Offers and orders take one party per call, every room the same: for different parties, order once per party.{{#if claude-skill cli}} `{{tool:hotels offers}}` answers `stay_unsupported` (`mixed_occupancy`) for mixed rooms; `{{tool:hotels search}}` accepts them but prices only from the dates, with the note `party_split_required`.{{/if}}\n{{#if claude-skill cli}}\n- Limits: 1\u2013{{limit:rooms}} rooms, 1\u2013{{limit:adultsPerRoom}} adults and 0\u2013{{limit:childrenPerRoom}} children (aged 0\u2013{{limit:childAgeMax}}) per room, 1\u2013{{limit:nightsSupplier}} nights, up to {{limit:offersHotels}} hotels per `{{tool:hotels offers}}` call. A longer stay answers `stay_unsupported` (`max_nights`): ask the user whether to split it into consecutive stays, each its own order.\n{{/if}}\n",
|
|
15468
15502
|
"order": '{{#if claude-skill cli}}\n## Workflow\n\n1. **Search** with `{{tool:hotels search}}` for candidate hotels: a destination, `{{arg:text}}` or both, and the stay\'s dates and rooms for indicative prices.\n{{#if cli}}\n\n ```bash\n {{tool:hotels search}} --place-name Bangkok --country TH --check-in 2026-11-10 \\\n --check-out 2026-11-12 --room 2 --stars-min 4 --sort price_asc --limit 10\n ```\n\n{{/if}}\n2. **Details** (optional) with `{{tool:hotels get}}`, when the user asks about a hotel or a stated preference needs evidence (a pool, a policy, room size). For a details-only question, call it directly when you know the hotel\'s `hotelId`; otherwise find the hotel with `{{tool:hotels search}}`.\n{{#if cli}}\n\n ```bash\n {{tool:hotels get}} <hotelId> [--rooms]\n ```\n\n{{/if}}\n3. **Offers** with `{{tool:hotels offers}}` for a few shortlisted hotels, with the dates and rooms the user will order. It takes about 15 seconds. A hotel is available only once this returns an offer for it.\n{{#if cli}}\n\n ```bash\n {{tool:hotels offers}} --hotel <hotelId> --hotel <hotelId> --check-in 2026-11-10 \\\n --check-out 2026-11-12 --room 2 --room 2 [--require-free-cancellation]\n ```\n\n{{/if}}\n4. **Order** with `{{tool:hotels book}}`, once the user has picked one offer and given the guests and the contact (see Ordering).\n{{#if cli}}\n\n ```bash\n {{tool:hotels book}} --offer <offerId> --guest 1:John:Smith --guest 2:Mary:Smith \\\n --first-name John --last-name Smith --email john@example.com \\\n --phone "+8613800000000"\n ```\n\n{{/if}}\n5. **Confirm, then give the payment link**, as in "Before giving the payment link" below.\n6. **After payment**, check the order with `{{tool:orders get}}` (see After payment).\n\n## Search\n\n### Where\n\n- **A place by name:** {{#if mcp claude-skill}}`{ kind: "place_name", name, countryCode }`{{/if}}{{#if cli}}`--place-name <name> --country <CC>`{{/if}}, in any language (Kyoto or \u4EAC\u90FD). The country is required: ask the user when it isn\'t clear. Names match exactly, ignoring only case and spacing: accents, hyphens, apostrophes and periods count ("K\xF6ln" or "Cologne", not "Koln"; "St. Moritz", not "St Moritz").\n- If several places bear the name, the answer is `destination_ambiguous` with up to {{limit:candidatesShown}} candidates and their hotel counts: ask the user which one they mean, then search it by its `placeId`; never pick one yourself.\n- `destination_not_found` with `no_match` means no place of that name in that country: check the spelling and accents, or try another name for the place. Its `nameAsText` counts the hotels that a `{{arg:text}}` search for the name would find.\n- **A place from an earlier answer:** {{#if mcp claude-skill}}`{ kind: "place", placeId }`{{/if}}{{#if cli}}`--place <placeId>`{{/if}}.\n- **Near a point:** {{#if mcp claude-skill}}`{ kind: "point", location: { lat, lng } }`{{/if}}{{#if cli}}`--point <lat,lng>`{{/if}}, for "near X" when you know where X is.\n- **A whole country:** {{#if mcp claude-skill}}`{ kind: "country", countryCode }`{{/if}}{{#if cli}}`--country-only <CC>`{{/if}}, as for the Maldives.\n- Countries, regions (states, provinces), prefecture-level cities in China and main islands cover their whole area. Towns, neighbourhoods, districts, small islands and points cover a circle of {{limit:radiusMetersDefault}} meters; `{{arg:destination.radiusMeters}}` sets another, up to {{limit:radiusMetersMax}} meters, and narrows an area to a circle around its center.\n- **Localities:** an area search lists its `localities`, the towns its hotels belong to, each with a `placeId`, its hotel `count` and the places it `includes` (Patong is part of Phuket). To search one, pass it as {{#if mcp claude-skill}}`{ kind: "locality", placeId }`{{/if}}{{#if cli}}`--locality <placeId>`{{/if}}. A town that isn\'t a locality answers `destination_not_found` with `not_a_locality` and the `hub` it belongs to: search the hub, or the town itself with {{#if mcp claude-skill}}`kind: "place"`{{/if}}{{#if cli}}`--place`{{/if}} for a circle around it.\n- A price sort or price filter over more than {{limit:poolLimit}} hotels (in an area, or for text alone) answers `search_too_broad` with `matched` and the top `localities`: show them and ask the user which they prefer, unless the request already names one of them; search that one by its `placeId` as a locality, never by its name.\n\n### Text\n\n`{{arg:text}}` matches exact words in hotel names and addresses, in Chinese or English:\n\n- Every word must match as written: plurals, accents, spacing and abbreviations count ("hostel" and "hostels", "St Regis" and "Saint Regis" find different hotels). Hyphens and apostrophes don\'t (Ritz-Carlton finds Ritz Carlton).\n- In Chinese, matching follows word segmentation, so part of a name can match unrelated hotels (\u5E0C\u5C14 is not \u5E0C\u5C14\u987F).\n- Use only distinctive words: a hotel or brand name, a district or a landmark. Not "hotel", "near", "cheap" or "best".\n- Typos return nothing: "Shangahi" finds no hotel.\n- Place names belong in the destination: "Maldives" as text finds a hotel named Maldives in China.\n\n### Filters\n\n- Stars run from 1 to 5 in half steps{{#if mcp claude-skill}} (`filters.stars`){{/if}}. "4 stars" as {{#if mcp claude-skill}}`{ min: 4, max: 4 }`{{/if}}{{#if cli}}`--stars-min 4 --stars-max 4`{{/if}} leaves out 4.5: unless the user means exactly 4, use {{#if mcp claude-skill}}`{ min: 4 }`{{/if}}{{#if cli}}`--stars-min 4`{{/if}} or ask. Unrated hotels are left out whenever stars are filtered.\n- `{{arg:filters.amenities}}` takes only the amenities that can filter (such as pool, parking, wifi); others, such as gym or spa, show in `{{tool:hotels get}}` but can\'t filter. A hotel matches only when it lists the amenity, and about half the hotels list no amenities at all (`coverage.excludedNoFacilityData` counts those left out): "not listed" is not "absent".\n- `{{arg:filters.price.maxPerRoomNight}}` bounds the indicative price per room per night, in USD; hotels without one are left out and counted.\n\n### Results\n\n- `notes` explain the answer (a limited pool, a circle around an island, more hotels just outside it): pass on what matters to the user.\n- `coverage` has the counts: `matched` hotels, how many were priced and how many have a price.\n- A next page is {{#if mcp claude-skill}}`cursor` set to `nextCursor` and, optionally, `limit`{{/if}}{{#if cli}}`--cursor <nextCursor>` and, optionally, `--limit`{{/if}}; nothing else.\n{{/if}}\n{{#if mcp}}\n- A place name needs its `countryCode` (ask the user if unclear) and matches exactly (accents and periods count). On `destination_ambiguous`, ask the user which they mean, then search its `placeId`; never pick one yourself.\n- On `search_too_broad`, show its `localities` and ask the user which, unless they already named one; search it as `{ kind: "locality", placeId }`, never by name.\n- `text` matches whole words of hotel names and addresses: use a distinctive name, brand or landmark. A typo finds nothing.\n{{/if}}\n',
|
|
15469
|
-
"payment-link": "{{#if claude-skill cli}}\n## Before giving the payment link\n\n`{{tool:hotels book}}` answers with an unpaid order: `status` `awaiting_payment`, its `reference` (the support number), `price.total`, the stay and its terms, and `payment.url`, a Fortrip page that recaps the order and continues to payment on Stripe. Nothing is charged until the user pays.\n\n1. Show the order's total and currency, the stay (hotel, room, dates, rooms and guests per room) and every term: meals, cancellation (status, deadline, penalties) and fees payable at the property, unknowns included.\n2. End that reply by asking the user to confirm, and wait for a clear yes. Urgency is not consent.\n3. Then give `payment.url` exactly as returned: don't shorten, rebuild or re-encode it.\n\n{{/if}}\n{{#if mcp}}\n- Before you give `payment.url`, show the user the order's total and currency, the stay and every term, end that reply by asking the user to confirm, and wait for a clear yes. Then give `payment.url` exactly as returned, to this user only: anyone holding it can pay.\n{{/if}}\n{{#if claude-skill cli}}\n- `payment.url` works like a payment credential: anyone holding it can pay. Give it to this user only, never in shared channels, documents, logs or tickets. With `requiresSignIn: true` (an order started on the Fortrip website), the user signs in to pay.\n- The link expires at `payment.expiresAt`; the order is then `expired`. To order the stay again, get offers again, and confirm the new order with the user before giving its link.\n- An order `awaiting_payment` whose `payment.url` is null had its link unreadable this time: read it again with `{{tool:orders get}}`.\n{{/if}}\n- Never ask for, accept or pass on payment card details; payment happens only on the payment page.{{#if claude-skill cli}} A card number in a guest name, the contact or the special requests is rejected{{#if cli}} with exit 2{{/if}}.{{/if}}\n{{#if claude-skill cli}}\n\n## After payment\n\nCheck the order with `{{tool:orders get}}`:\n\n- `confirming` while the hotel confirms, then `confirmed` with the hotel's `confirmationNumber`.\n- `failed`: no stay was booked; `payment.status` says whether the payment was released or refunded.\n- `needs_attention`: Fortrip is looking into it; the user can email {{support}} with the `reference`.\n- `manageUrl` is the user's own page for the order.\n{{/if}}\n",
|
|
15503
|
+
"payment-link": "{{#if claude-skill cli}}\n## Before giving the payment link\n\n`{{tool:hotels book}}` answers with an unpaid order: `status` `awaiting_payment`, its `reference` (the support number), `price.total`, the stay and its terms, and `payment.url`, a Fortrip page that recaps the order and continues to payment on Stripe. Nothing is charged until the user pays.\n\n1. Show the order's total and currency, the stay (hotel, room, dates, rooms and guests per room) and every term: meals, cancellation (status, deadline, penalties) and fees payable at the property, unknowns included.\n2. End that reply by asking the user to confirm, and wait for a clear yes. Urgency is not consent.\n3. Then give `payment.url` exactly as returned: don't shorten, rebuild or re-encode it.\n\n{{/if}}\n{{#if mcp}}\n- Before you give `payment.url`, show the user the order's total and currency, the stay and every term, end that reply by asking the user to confirm, and wait for a clear yes. Then give `payment.url` exactly as returned, to this user only: anyone holding it can pay.\n{{/if}}\n{{#if claude-skill cli}}\n- `payment.url` works like a payment credential: anyone holding it can pay. Give it to this user only, never in shared channels, documents, logs or tickets. With `requiresSignIn: true` (an order started on the Fortrip website), the user signs in to pay.\n- The link expires at `payment.expiresAt`; the order is then `expired`. To order the stay again, get offers again, and confirm the new order with the user before giving its link.\n- Another order of the stay (another party, or a corrected guest name) needs a new offer: get offers again. When it replaces an unpaid order, tell the user to pay only the new link; the earlier one expires unpaid.\n- An order `awaiting_payment` whose `payment.url` is null had its link unreadable this time: read it again with `{{tool:orders get}}`.\n{{/if}}\n- Never ask for, accept or pass on payment card details; payment happens only on the payment page.{{#if claude-skill cli}} A card number in a guest name, the contact or the special requests is rejected{{#if cli}} with exit 2{{/if}}.{{/if}}\n{{#if claude-skill cli}}\n\n## Paying without the link\n\nAn order with `payment.handlers` can also be paid with a Stripe shared payment token that the user's wallet (Link) grants for it, through `{{tool:orders pay}}`:\n\n1. Show and ask exactly as before giving the payment link, and wait for a clear yes. The token comes from the user's wallet, never from card details.\n2. Request the token from the user's wallet with the handler's `networkId` and `payment.credentialLimits`: `maxAmount` (in cents), `currency` and `expiresAt`.\n3. {{#if claude-skill}}Call{{/if}}{{#if cli}}Run{{/if}} `{{tool:orders pay}}` with the token and the order's `price.total`{{#if cli}} (`--token`, `--total`){{/if}}. The order is then `confirming`, its payment `authorized`: check it as after payment.\n\nThe charge is in USD: a card in another currency may add a foreign transaction fee. Pay one way only: once `{{tool:orders pay}}` succeeds, `payment.url` stops working; a payment that fails leaves the link open. `payment_total_changed` means the total changed: show the new total and ask again, for a new token. `payment_declined`: the user picks another payment method in their wallet, or pays by link. `payment_action_required`: the card needs a verification this can't give: pay by link. `payment_credential_invalid`: request a new token with the order's `payment.credentialLimits`. `service_unavailable`: call `{{tool:orders pay}}` again with the same token, never a new one. A token pays one order only.\n\n## After payment\n\nCheck the order with `{{tool:orders get}}`:\n\n- `confirming` while the hotel confirms, then `confirmed` with the hotel's `confirmationNumber`.\n- `failed`: no stay was booked; `payment.status` says whether the payment was released or refunded.\n- `needs_attention`: Fortrip is looking into it; the user can email {{support}} with the `reference`.\n- `manageUrl` is the user's own page for the order.\n{{/if}}\n",
|
|
15470
15504
|
"planning": "# Planning a hotel stay\n\nRead this when the request is more than one hotel for fixed dates: flexible dates, a budget, split stays, several destinations, or \"find me the best\". The rules in {{#if mcp}}the server instructions{{/if}}{{#if claude-skill}}SKILL.md{{/if}}{{#if cli}}`{{tool:guide}}`{{/if}} still apply (call order, destinations, one party per offer and order, confirming the order `{{tool:hotels book}}` returns before giving the payment link); this covers what to ask, how to compare and how to present.{{#if cli}} As there, `fortrip` is short for `npx -y fortrip@latest`.{{/if}}\n\n## What to collect\n\nKeep track of: dates (or the flexible window), nights, destination(s) with their country, rooms and the guests in each room, room constraints (beds, connecting rooms, accessibility), budget, and what the user said matters most (cheapest, most flexible, closest to X).\n\nOffers and orders take one party per call, every room the same, so if the party doesn't split evenly across the rooms, ask how it splits. Rooms for different parties are priced and ordered separately, each order with its own payment link.\n\nAsk only for what changes which hotels qualify or how they rank. \"4 stars\" as {{#if mcp claude-skill}}`{ min: 4, max: 4 }`{{/if}}{{#if cli}}`--stars-min 4 --stars-max 4`{{/if}} leaves out 4.5: unless the user means exactly 4, use {{#if mcp claude-skill}}`{ min: 4 }`{{/if}}{{#if cli}}`--stars-min 4`{{/if}} or ask. If children come along, ask each child's age; `{{tool:hotels offers}}` needs it. Don't ask for trip type or style: infer it from the conversation or leave it general. When a place name is ambiguous, ask which place the user means.\n\n## Evidence\n\n- A `{{tool:hotels search}}` price is an indicative estimate per room per night, not a quote. Never call a search result available or bookable, and once you have offers, compare offers only. A hotel without a search price can still have offers.\n- Use `{{tool:hotels get}}` only when a stated preference needs evidence (a pool, a policy, room size). An amenity or policy it doesn't list is unknown, not absent.\n- A hotel is available only once `{{tool:hotels offers}}` returned an offer for it.\n- Anything {{#if mcp claude-skill}}the tools{{/if}}{{#if cli}}the CLI{{/if}} didn't return, such as reviews, style, price trends or exchange rates other than `approx`, is unknown. Say so instead of filling it in.\n\n## Ranking\n\n1. Drop options that break a hard constraint (dates, guests, budget cap, required facility). Compare a budget in the unit the user gave it: per night, per room or for the whole stay. An offer's `price.total` covers the whole stay and every room, in USD.\n2. Keep only options with a live offer.\n3. Order by the user's stated main goal. Goals they didn't state don't count.\n4. Use other preferences only to break ties.\n\nUse the cheapest comparable offer as the baseline unless the user fixed the room type. Show at most three plans, each with its price difference from the baseline and what it trades off (meals, cancellation, location, confirmation). Keep hotel names as returned and dates in the user's notation.\n\nFor a split stay or several destinations, price each leg with its own `{{tool:hotels offers}}` call and add up the legs. Each leg is a separate `{{tool:hotels book}}` call, with its own confirmation and its own payment link.\n\n## Stop and say so\n\n- `{{tool:hotels offers}}` covers up to {{limit:offersHotels}} hotels per call and takes about 15 seconds, and its offers expire after about 30 minutes. If the request needs more hotels or date combinations than a few calls can cover, narrow it with the user, or present the result as a comparison of the hotels you priced, not the best overall.\n- When a search is too broad to price, show its localities and ask the user which they prefer, unless the request already names one of them; never pick one yourself.\n- Urgency is not consent. Call `{{tool:hotels book}}` only for the offer the user picked, and give its payment link only after the user confirms the total, currency, stay and terms of the order `{{tool:hotels book}}` returned.\n",
|
|
15471
15505
|
"presentation": "{{#if claude-skill}}\n## Presenting hotels\n\nIf your interface can show rich elements, show each hotel as a card with only what Fortrip's tools returned for it in this conversation: photo, name, stars, region and price, and once you have offers every term that changes the choice (meals and who they cover, cancellation, fees payable at the property, confirmation), an unknown one as unknown. Label a search's `price.fromPerRoomNight` as an estimate per room-night and an offer's `price.total` as the whole stay for all rooms, in USD, and draw a map only from returned `location` coordinates. Offer the choices you need to ask anyway (dates, a locality, which offer) as options to pick. Otherwise use a short list. Keep hotel names as returned, and never invent photos, ratings, reviews, prices, terms or coordinates.\n{{/if}}\n",
|
|
15472
15506
|
"prices": "{{#if claude-skill cli}}\n## Prices and currency\n\n- A search price (`price.fromPerRoomNight`) is indicative and not bookable: the lowest price of one unit (a room or, at a hostel, possibly a bed) per night, for any party and often any date, and it can be well above or below the offers. Call it an estimate, quote `{{tool:hotels offers}}` prices, and never call a search result available or bookable. `price: null` means there is no indicative price, not that the hotel is full; about half the hotels have none for given dates.\n{{/if}}\n{{#if mcp}}\n- Search prices are indicative, not bookable: quote `{{tool:hotels offers}}` prices.\n{{/if}}\n- {{#if claude-skill cli}}In an offer or order, {{/if}}`price.total` is the whole stay for all rooms and is what is charged, in USD for offers and the orders made from them.{{#if claude-skill cli}} `perNightAllRooms` is the total per night; to compare with a per-room budget, also divide by the rooms.{{/if}} Stripe's page may let the user pay in their card's local currency at Stripe's rate (Adaptive Pricing){{#if claude-skill cli}}: say so plainly, and that the USD total is the price{{/if}}. `approx`{{#if claude-skill cli}}, in `{{arg:displayCurrency}}`, with its `rateDate`,{{/if}} is an estimate, never the charge.\n{{#if claude-skill cli}}\n- `{{arg:displayCurrency}}`{{#if cli}} (or `FORTRIP_DISPLAY_CURRENCY`){{/if}} is `USD` or `CNY`: `CNY` adds `approx` in yuan to suit a user who thinks in it. It never changes the charge.\n- Fees payable at the property (`payAtProperty`) are separate, in the property's own currency, not converted.\n- After payment, `payment.localCharge` is what the card paid in its own currency. Orders made on the Fortrip website can be charged in another currency: `payment.chargeCurrency` says which.\n{{/if}}\n",
|
|
15473
|
-
"scope": "{{#if claude-skill cli}}\n# Fortrip hotel stays\n\n{{/if}}\nFortrip: hotel search, live offers and orders with a payment link.{{#if claude-skill cli}} Not for flights, activities, or changing an existing order.{{/if}}\n\n{{#if mcp}}\nCall order: `{{tool:hotels search}}` \u2192 (optional) `{{tool:hotels get}}` \u2192 `{{tool:hotels offers}}` \u2192 `{{tool:hotels book}}`; after the user pays, `{{tool:orders get}}`; `{{tool:orders list}}` lists
|
|
15474
|
-
"setup": "{{#if cli}}\n## Setup\n\nRun every command as `npx -y fortrip@latest <command>` (Node.js 22 or newer). The examples below shorten that to `fortrip`; `fortrip <command> --help` lists a command's flags. `{{tool:hotels search}}`, `{{tool:hotels offers}}` and `{{tool:hotels book}}` also take `--body '<json>'` (or `--body @file.json`), the raw request body; flags override its fields. Add `--json` to any command that calls Fortrip to get its answer as one line of JSON instead of text.\n\nWhen the user first asks about hotels, run `{{tool:whoami}}` before asking follow-up questions, so the sign-in can happen while they answer.\n\n{{/if}}\n{{#if claude-skill cli}}\n## Sign-in\n\n{{/if}}\nSign-in happens only in the browser. Never ask the user to paste a token.\n{{#if claude-skill}}\n\nIf none of these tools are available, Fortrip isn't connected: tell the user to add the Fortrip connector or plugin and sign in.\n{{/if}}\n{{#if mcp claude-skill}}\nIf a tool says the user isn't signed in, ask them to reconnect
|
|
15507
|
+
"scope": "{{#if claude-skill cli}}\n# Fortrip hotel stays\n\n{{/if}}\nFortrip: hotel search, live offers and orders with a payment link.{{#if claude-skill cli}} Not for flights, activities, or changing an existing order.{{/if}}\n\n{{#if mcp}}\nCall order: `{{tool:hotels search}}` \u2192 (optional) `{{tool:hotels get}}` \u2192 `{{tool:hotels offers}}` \u2192 `{{tool:hotels book}}`; after the user pays, `{{tool:orders get}}`; `{{tool:orders list}}` lists them; `{{tool:orders cancel}}` cancels one, `{{tool:orders pay}}` pays by token. `{{tool:guide}}` returns Fortrip's guidance for flexible dates, budgets or several destinations.\n{{/if}}\n{{#if claude-skill}}\nThe tools are on Fortrip's MCP server, named `fortrip` in this plugin (a Fortrip connector added on claude.ai can show under its own name). They're written `fortrip:<tool>` below:\n{{/if}}\n{{#if cli}}\nThe `fortrip` CLI (npm package `fortrip`) calls Fortrip as the signed-in user and prints each answer as compact text (`--json` prints its JSON):\n{{/if}}\n{{#if claude-skill cli}}\n\n| {{#if claude-skill}}Tool{{/if}}{{#if cli}}Command{{/if}} | Returns |\n|---|---|\n| `{{tool:hotels search}}` | Hotels in a place, near a point or matching a name (`{{arg:text}}`), with indicative prices |\n| `{{tool:hotels get}}` | One hotel's address, check-in and check-out times, description, policies, amenities and rooms; no prices |\n| `{{tool:hotels offers}}` | Live offers (room, meals, total in USD, cancellation terms) for up to {{limit:offersHotels}} hotels |\n| `{{tool:hotels book}}` | An unpaid order for one offer, with its terms and a payment link |\n| `{{tool:orders get}}` | One order and its status, including whether the hotel confirmed it |\n| `{{tool:orders list}}` | The user's orders, newest first, including those made on the Fortrip website |\n| `{{tool:orders cancel}}` | Cancels an order under its terms, for the penalty the user agreed to, and refunds the rest |\n| `{{tool:orders pay}}` | Pays an order without its link, with a shared payment token from the user's wallet |\n\nFor flexible dates, a budget, split stays, several destinations or \"find me the best\", {{#if claude-skill}}read [references/planning.md](references/planning.md){{/if}}{{#if cli}}also run `{{tool:guide}} planning`{{/if}} before searching.\n{{/if}}\n",
|
|
15508
|
+
"setup": "{{#if cli}}\n## Setup\n\nRun every command as `npx -y fortrip@latest <command>` (Node.js 22 or newer). The examples below shorten that to `fortrip`; `fortrip <command> --help` lists a command's flags. `{{tool:hotels search}}`, `{{tool:hotels offers}}` and `{{tool:hotels book}}` also take `--body '<json>'` (or `--body @file.json`), the raw request body; flags override its fields. Add `--json` to any command that calls Fortrip to get its answer as one line of JSON instead of text.\n\nWhen the user first asks about hotels, run `{{tool:whoami}}` before asking follow-up questions, so the sign-in can happen while they answer.\n\n{{/if}}\n{{#if claude-skill cli}}\n## Sign-in\n\n{{/if}}\nSign-in happens only in the browser. Never ask the user to paste a token.\n{{#if claude-skill}}\n\nIf none of these tools are available, Fortrip isn't connected: tell the user to add the Fortrip connector or plugin and sign in.\n{{/if}}\n{{#if mcp claude-skill}}\nIf a tool says the user isn't signed in, ask them to reconnect.\n{{/if}}\n{{#if cli}}\n\nIf a command exits with code **3** and stderr has `loginUrl`, show it to the user as a link together with `userCode`, e.g. \"Sign in to Fortrip: <loginUrl> (code <userCode>), then tell me when you're done.\" When they confirm, rerun the same command; it finishes the sign-in itself. Don't run `{{tool:login}}`: it waits for up to 10 minutes. Commands that exit 3 together share one `loginUrl`; show it once. If the rerun gives a different `loginUrl`, show that one.\n\nWhen Fortrip no longer accepts the saved sign-in (it was revoked, or it expired and couldn't be renewed), the command also exits 3 with a `loginUrl`; handle it the same way. The saved sign-in is kept until the user approves the new link.\n\nIn CI or a sandbox without a browser, the user can set `FORTRIP_TOKEN` instead. Exit 3 with `tokenSource: \"FORTRIP_TOKEN\"` means Fortrip didn't accept that token: tell the user to replace or unset it.\n\n## Exit codes\n\n| Code | Meaning | What to do |\n|---|---|---|\n| 0 | Success; the answer on stdout | Continue |\n| 1 | Any other error: an error from Fortrip (see Errors), a network error or a timeout | Read the error on stderr. If `retryable` is true, wait `retryAfterSeconds` (or a few seconds) and retry once |\n| 2 | Invalid arguments, or `invalid_request` from Fortrip | Fix the flags; the error lists each bad field with a message |\n| 3 | Not signed in | Show `loginUrl` to the user, then rerun (above) |\n| 4 | Rate limited | Wait `retryAfterSeconds`, then retry once |\n\nOutput on stdout or stderr can carry `warning` (with `recoveryFile` when a sign-in couldn't be saved): pass it on to the user.\n{{/if}}\n",
|
|
15475
15509
|
"support": "{{#if claude-skill cli}}\n## Cancelling an order\n\n`{{tool:orders get}}` and `{{tool:orders list}}` say of each order whether the user can cancel it now (`cancel.available`), and then the penalty under its terms (`cancel.penalty`) and the refund, what was paid less the penalty (`cancel.refund`), both in the charge currency; otherwise `cancel.reason` says why not.\n\n1. Show the user the stay (hotel, dates), `cancel.penalty` and `cancel.refund` (amount and currency). A refund of 0 means nothing is paid back: say so plainly.\n2. End that reply by asking the user to confirm the cancellation, and wait for a clear yes.\n3. Then {{#if claude-skill}}call{{/if}}{{#if cli}}run{{/if}} `{{tool:orders cancel}}` with `{{arg:maximumPenalty}}` set to `cancel.penalty.amount` as shown. Never state a refund the order didn't return, and never choose or work out an amount yourself.\n\nThe order is then `cancelling`, and `cancelled` once the hotel has cancelled and the refund is issued: check it with `{{tool:orders get}}`. If the hotel refuses, the order is `confirmed` again with `cancel.reason` `refused`. `cancellation_changed` (409) means the penalty is now higher than the one the user agreed to: read the order again and ask the user again. `order_not_cancellable` (409) says why in `reason`.{{#if cli}} Without `--max-penalty`, `{{tool:orders cancel}}` cancels nothing: it prints the penalty and the refund and exits 2.{{/if}}\n\n## Changes and support\n\n{{/if}}\n{{#if mcp}}For changes{{/if}}{{#if claude-skill}}These tools can't change an order: for changes{{/if}}{{#if cli}}The CLI can't change an order: for changes{{/if}}, a cancellation that `{{tool:orders cancel}}` can't make, or other problems, the user emails {{support}} with the order's `reference` (never `payment.url`).\n"
|
|
15476
15510
|
};
|
|
15477
15511
|
|
|
@@ -16018,6 +16052,22 @@ var CANCEL_REASONS = [
|
|
|
16018
16052
|
"terms_unknown",
|
|
16019
16053
|
"needs_attention"
|
|
16020
16054
|
];
|
|
16055
|
+
var CREDENTIAL_INVALID_REASONS = [
|
|
16056
|
+
"not_found",
|
|
16057
|
+
"currency",
|
|
16058
|
+
"amount",
|
|
16059
|
+
"expired",
|
|
16060
|
+
"deactivated",
|
|
16061
|
+
"used",
|
|
16062
|
+
"other_seller"
|
|
16063
|
+
];
|
|
16064
|
+
var paymentHandler = openObject({
|
|
16065
|
+
id: external_exports.string(),
|
|
16066
|
+
type: external_exports.string(),
|
|
16067
|
+
version: external_exports.string(),
|
|
16068
|
+
spec: external_exports.string(),
|
|
16069
|
+
networkId: external_exports.string().nullable()
|
|
16070
|
+
});
|
|
16021
16071
|
var orderReference = external_exports.string().regex(/^FT-[2-9A-HJ-NP-Z]{6}$/);
|
|
16022
16072
|
var hotelItem = openObject({
|
|
16023
16073
|
type: external_exports.literal("hotel"),
|
|
@@ -16054,7 +16104,20 @@ var order = openObject({
|
|
|
16054
16104
|
expiresAt: instant.nullable(),
|
|
16055
16105
|
chargeCurrency: external_exports.string(),
|
|
16056
16106
|
localCurrencyAtCheckout: external_exports.boolean(),
|
|
16057
|
-
localCharge: money.nullable()
|
|
16107
|
+
localCharge: money.nullable(),
|
|
16108
|
+
/** The ways to pay other than `url`, while the order can be paid that
|
|
16109
|
+
* way (3.4): a `com.stripe.payments` handler takes a shared payment
|
|
16110
|
+
* token through `pay_order`. Absent when there is none. */
|
|
16111
|
+
handlers: external_exports.array(paymentHandler).optional(),
|
|
16112
|
+
/** What a payment credential for `pay_order` must allow, present with
|
|
16113
|
+
* `handlers` (3.4): `maxAmount` in minor units (cents) of `currency`,
|
|
16114
|
+
* lowercase as Stripe takes it, and `expiresAt`, past which the order
|
|
16115
|
+
* can't be paid. */
|
|
16116
|
+
credentialLimits: openObject({
|
|
16117
|
+
maxAmount: external_exports.number().int(),
|
|
16118
|
+
currency: external_exports.string(),
|
|
16119
|
+
expiresAt: instant
|
|
16120
|
+
}).optional()
|
|
16058
16121
|
}),
|
|
16059
16122
|
/** Whether the user can cancel the order now and, when they can, its
|
|
16060
16123
|
* penalty under the accepted terms (read a minute ahead) and the refund,
|
|
@@ -16091,6 +16154,7 @@ var offerChange = openUnion("field", [
|
|
|
16091
16154
|
// ../contract/src/tools.ts
|
|
16092
16155
|
var ORDER_NEXT_STEP = "Before you give the user an order's payment.url, show them its total and currency, the stay (hotel, room, dates, rooms and guests per room) and every term (meals, cancellation, fees payable at the property), then end your reply by asking them to confirm, and wait for a clear yes. Only after they say yes, give them payment.url exactly as returned.";
|
|
16093
16156
|
var CANCEL_NEXT_STEP = "Before you call cancel_order, show the user the order's stay (hotel, dates), cancel.penalty and cancel.refund (amount and currency), then end your reply by asking them to confirm the cancellation, and wait for a clear yes. Pass maximumPenalty exactly as cancel.penalty.amount. Never state a refund the order did not return.";
|
|
16157
|
+
var PAY_NEXT_STEP = "To pay without the link, when the order has payment.handlers and the user's wallet can grant a Stripe shared payment token: first show and ask exactly as for payment.url, and wait for a clear yes. Then request the token for this order from the user's wallet with the handler's networkId and payment.credentialLimits (maxAmount in cents, currency, expiresAt), and call pay_order with it and the order's price.total. The charge is in USD: a card in another currency may add a foreign transaction fee. Pay one way only: once pay_order succeeds, payment.url stops working.";
|
|
16094
16158
|
var nextStep = external_exports.string().optional().describe(
|
|
16095
16159
|
"What to show and ask before giving a payment.url. Present when the answer holds a non-null payment.url, and only then."
|
|
16096
16160
|
);
|
|
@@ -16098,7 +16162,8 @@ var MCP_OUTPUT = {
|
|
|
16098
16162
|
book_hotel: order.extend({ nextStep }),
|
|
16099
16163
|
get_order: order.extend({ nextStep }),
|
|
16100
16164
|
list_orders: orderList.extend({ nextStep }),
|
|
16101
|
-
cancel_order: order
|
|
16165
|
+
cancel_order: order,
|
|
16166
|
+
pay_order: order
|
|
16102
16167
|
};
|
|
16103
16168
|
var READ = {
|
|
16104
16169
|
readOnlyHint: true,
|
|
@@ -16143,7 +16208,7 @@ var TOOLS = [
|
|
|
16143
16208
|
{
|
|
16144
16209
|
name: "book_hotel",
|
|
16145
16210
|
title: "Create hotel order and payment link",
|
|
16146
|
-
description: `Order one offer from get_hotel_offers. The answer is an unpaid order with a payment link: status awaiting_payment, the total, the stay and its terms, and payment.url, a Fortrip page where the user pays. Nothing is charged until the user pays there; anyone holding the link can pay. Send the contact and, for each room of the offer, at least one guest. If the price or terms changed since the offer, the answer is offer_changed with every change and a new offer: show the changes and ask the user again before ordering it. Sending the same details again returns the same order. To cancel an order, use cancel_order; for changes, or a cancellation cancel_order can't make, the user emails ${SUPPORT_EMAIL} with the order's reference.`,
|
|
16211
|
+
description: `Order one offer from get_hotel_offers. The answer is an unpaid order with a payment link: status awaiting_payment, the total, the stay and its terms, and payment.url, a Fortrip page where the user pays. Nothing is charged until the user pays there; anyone holding the link can pay. Send the contact and, for each room of the offer, at least one guest. If the price or terms changed since the offer, the answer is offer_changed with every change and a new offer: show the changes and ask the user again before ordering it. Sending the same details again returns the same order. An offer is ordered once: for another order of the stay (another party, or a corrected guest name), get offers again and order the new offer; when it replaces an unpaid order, tell the user to pay only the new link, as the earlier one expires unpaid. To cancel an order, use cancel_order; for changes, or a cancellation cancel_order can't make, the user emails ${SUPPORT_EMAIL} with the order's reference.`,
|
|
16147
16212
|
annotations: {
|
|
16148
16213
|
readOnlyHint: false,
|
|
16149
16214
|
idempotentHint: false,
|
|
@@ -16181,6 +16246,19 @@ var TOOLS = [
|
|
|
16181
16246
|
},
|
|
16182
16247
|
input: cancelOrderInput,
|
|
16183
16248
|
output: MCP_OUTPUT.cancel_order
|
|
16249
|
+
},
|
|
16250
|
+
{
|
|
16251
|
+
name: "pay_order",
|
|
16252
|
+
title: "Pay order with a shared payment token",
|
|
16253
|
+
description: "Pay an order awaiting payment without its link, with a Stripe shared payment token, when the order has payment.handlers. First show and ask exactly as for payment.url, and wait for a clear yes. Then request the token from the user's wallet with the handler's networkId and payment.credentialLimits, and pass it with the order's price.total. The charge is in USD. Once it succeeds, payment.url stops working; a payment that fails leaves the link open. Answers the order: status confirming, the payment authorized (held, charged once the hotel confirms); poll get_order. payment_total_changed: show details.total and ask again, for a new token. payment_declined: the user picks another payment method in their wallet, or pays by link. payment_action_required: the card needs a verification this can't give; pay by link. payment_credential_invalid: request a new token. service_unavailable: call pay_order again with the same token, never a new one. A token pays one order only; the same token again answers as before.",
|
|
16254
|
+
annotations: {
|
|
16255
|
+
readOnlyHint: false,
|
|
16256
|
+
idempotentHint: true,
|
|
16257
|
+
openWorldHint: true,
|
|
16258
|
+
destructiveHint: false
|
|
16259
|
+
},
|
|
16260
|
+
input: payOrderInput,
|
|
16261
|
+
output: MCP_OUTPUT.pay_order
|
|
16184
16262
|
}
|
|
16185
16263
|
];
|
|
16186
16264
|
|
|
@@ -16200,6 +16278,13 @@ var ERROR_CODES = {
|
|
|
16200
16278
|
order_attempts_exhausted: { status: [409], retryable: false },
|
|
16201
16279
|
cancellation_changed: { status: [409], retryable: false },
|
|
16202
16280
|
order_not_cancellable: { status: [409], retryable: false },
|
|
16281
|
+
order_not_payable: { status: [409], retryable: false },
|
|
16282
|
+
payment_in_progress: { status: [409], retryable: true },
|
|
16283
|
+
payment_total_changed: { status: [409], retryable: false },
|
|
16284
|
+
payment_credential_invalid: { status: [422], retryable: false },
|
|
16285
|
+
payment_declined: { status: [402], retryable: false },
|
|
16286
|
+
payment_action_required: { status: [402], retryable: false },
|
|
16287
|
+
payment_method_unavailable: { status: [403], retryable: false },
|
|
16203
16288
|
destination_ambiguous: { status: [422], retryable: false },
|
|
16204
16289
|
destination_not_found: { status: [422], retryable: false },
|
|
16205
16290
|
search_too_broad: { status: [422], retryable: false },
|
|
@@ -16239,6 +16324,15 @@ var ERROR_DETAILS = {
|
|
|
16239
16324
|
order_attempts_exhausted: openObject({ orderId }),
|
|
16240
16325
|
cancellation_changed: null,
|
|
16241
16326
|
order_not_cancellable: openObject({ reason: openEnum(CANCEL_REASONS) }),
|
|
16327
|
+
order_not_payable: openObject({ orderId, status: openEnum(ORDER_STATUSES) }),
|
|
16328
|
+
payment_in_progress: openObject({ orderId }),
|
|
16329
|
+
payment_total_changed: openObject({ orderId, total: money }),
|
|
16330
|
+
payment_credential_invalid: openObject({
|
|
16331
|
+
reason: openEnum(CREDENTIAL_INVALID_REASONS)
|
|
16332
|
+
}),
|
|
16333
|
+
payment_declined: openObject({ declineCode: external_exports.string().nullable() }),
|
|
16334
|
+
payment_action_required: null,
|
|
16335
|
+
payment_method_unavailable: null,
|
|
16242
16336
|
destination_ambiguous: openObject({
|
|
16243
16337
|
name: external_exports.string(),
|
|
16244
16338
|
countryCode: external_exports.string(),
|
|
@@ -16297,7 +16391,8 @@ var ERROR_DETAILS = {
|
|
|
16297
16391
|
"hotel",
|
|
16298
16392
|
"orders_read",
|
|
16299
16393
|
"orders_create",
|
|
16300
|
-
"orders_cancel"
|
|
16394
|
+
"orders_cancel",
|
|
16395
|
+
"orders_pay"
|
|
16301
16396
|
])
|
|
16302
16397
|
}),
|
|
16303
16398
|
ordering_paused: null,
|
|
@@ -16613,10 +16708,18 @@ function paymentLines(o) {
|
|
|
16613
16708
|
} else if (o.status === "awaiting_payment") {
|
|
16614
16709
|
lines.push("Payment link: could not be read this time; read this order again for it.");
|
|
16615
16710
|
}
|
|
16711
|
+
if (p.handlers?.length) lines.push(handlersLine(p.handlers, p.credentialLimits));
|
|
16616
16712
|
if (o.cancel) lines.push(cancelLine(o.cancel));
|
|
16617
16713
|
lines.push(`Manage: ${o.manageUrl}`);
|
|
16618
16714
|
return lines;
|
|
16619
16715
|
}
|
|
16716
|
+
function handlersLine(handlers, limits) {
|
|
16717
|
+
const shown = handlers.map(
|
|
16718
|
+
(h) => `${h.type} (handler ${h.id}${h.networkId ? `, networkId ${h.networkId}` : ""})`
|
|
16719
|
+
);
|
|
16720
|
+
const limit = limits ? `; token limits: maxAmount ${limits.maxAmount} (cents), currency ${limits.currency}, expiresAt ${limits.expiresAt}` : "";
|
|
16721
|
+
return `Pay without the link: pay_order with a shared payment token via ${shown.join(", ")}${limit}`;
|
|
16722
|
+
}
|
|
16620
16723
|
function cancelLine(c) {
|
|
16621
16724
|
const figure = (name, m) => `${name} ${m ? money2(m) : "not stated"}`;
|
|
16622
16725
|
const figures = `${figure("penalty", c.penalty)}, ${figure("refund", c.refund)}`;
|
|
@@ -16826,6 +16929,15 @@ function renderSearch(r) {
|
|
|
16826
16929
|
}
|
|
16827
16930
|
|
|
16828
16931
|
// ../contract/src/render/errors.ts
|
|
16932
|
+
var CREDENTIAL_INVALID_WORDS = {
|
|
16933
|
+
not_found: "was not found",
|
|
16934
|
+
currency: "is for another currency than USD",
|
|
16935
|
+
amount: "allows less than the order's total",
|
|
16936
|
+
expired: "expires before it can be charged",
|
|
16937
|
+
deactivated: "was revoked",
|
|
16938
|
+
used: "was already used, or is held for another order",
|
|
16939
|
+
other_seller: "was granted to another seller"
|
|
16940
|
+
};
|
|
16829
16941
|
var isObject2 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
16830
16942
|
function changeLine(c) {
|
|
16831
16943
|
const worse = c.worse === true ? " (worse)" : c.worse === false ? " (not worse)" : "";
|
|
@@ -16942,6 +17054,24 @@ function detailLines(e) {
|
|
|
16942
17054
|
return [`Order ${e.details.orderId}, ${label(ORDER_STATUS_WORDS, e.details.status)}.`];
|
|
16943
17055
|
case "order_not_cancellable":
|
|
16944
17056
|
return [`Not cancellable: ${label(CANCEL_REASON_WORDS, e.details.reason)}.`];
|
|
17057
|
+
case "order_not_payable":
|
|
17058
|
+
return [
|
|
17059
|
+
`Order ${e.details.orderId}, ${label(ORDER_STATUS_WORDS, e.details.status)}: read it with get_order; nothing was charged.`
|
|
17060
|
+
];
|
|
17061
|
+
case "payment_in_progress":
|
|
17062
|
+
return [`Order ${e.details.orderId}: read it with get_order in a few seconds.`];
|
|
17063
|
+
case "payment_total_changed":
|
|
17064
|
+
return [
|
|
17065
|
+
`Order ${e.details.orderId} now totals ${money2(e.details.total)}: show the user the new total and ask again, then request a new token for it. Nothing was charged.`
|
|
17066
|
+
];
|
|
17067
|
+
case "payment_credential_invalid":
|
|
17068
|
+
return [
|
|
17069
|
+
`The token ${label(CREDENTIAL_INVALID_WORDS, e.details.reason)}: request a new one with the order's payment.credentialLimits. Nothing was charged.`
|
|
17070
|
+
];
|
|
17071
|
+
case "payment_declined":
|
|
17072
|
+
return [
|
|
17073
|
+
`Declined${e.details.declineCode ? ` (${e.details.declineCode})` : ""}: the user picks another payment method in their wallet for a new token, or pays by link (call book_hotel again with the same details for a new payment.url).`
|
|
17074
|
+
];
|
|
16945
17075
|
case "destination_ambiguous":
|
|
16946
17076
|
return ambiguous(e.details);
|
|
16947
17077
|
case "destination_not_found":
|
|
@@ -17086,6 +17216,7 @@ ${raw(data)}`;
|
|
|
17086
17216
|
return [
|
|
17087
17217
|
text2,
|
|
17088
17218
|
ORDER_TOOLS.has(tool) && holdsPaymentUrl(data) ? ORDER_NEXT_STEP : "",
|
|
17219
|
+
ORDER_TOOLS.has(tool) && holdsHandlers(data) ? PAY_NEXT_STEP : "",
|
|
17089
17220
|
CANCEL_TOOLS.has(tool) && holdsCancellable(data) ? CANCEL_NEXT_STEP : ""
|
|
17090
17221
|
].filter(Boolean).join("\n\n");
|
|
17091
17222
|
}
|
|
@@ -17106,6 +17237,7 @@ ${raw(data)}`;
|
|
|
17106
17237
|
return withConsent(tool, renderOrderList(list), list.data);
|
|
17107
17238
|
}
|
|
17108
17239
|
case "cancel_order":
|
|
17240
|
+
case "pay_order":
|
|
17109
17241
|
return renderOrder(parsed);
|
|
17110
17242
|
}
|
|
17111
17243
|
}
|
|
@@ -17120,6 +17252,15 @@ function holdsPaymentUrl(value, seen = /* @__PURE__ */ new Set()) {
|
|
|
17120
17252
|
}
|
|
17121
17253
|
return Object.values(value).some((v) => holdsPaymentUrl(v, seen));
|
|
17122
17254
|
}
|
|
17255
|
+
function holdsHandlers(value, seen = /* @__PURE__ */ new Set()) {
|
|
17256
|
+
if (typeof value !== "object" || value === null || seen.has(value)) return false;
|
|
17257
|
+
seen.add(value);
|
|
17258
|
+
const payment = value.payment;
|
|
17259
|
+
if (typeof payment === "object" && payment !== null && Array.isArray(payment.handlers) && payment.handlers.length > 0) {
|
|
17260
|
+
return true;
|
|
17261
|
+
}
|
|
17262
|
+
return Object.values(value).some((v) => holdsHandlers(v, seen));
|
|
17263
|
+
}
|
|
17123
17264
|
function holdsCancellable(value, seen = /* @__PURE__ */ new Set()) {
|
|
17124
17265
|
if (typeof value !== "object" || value === null || seen.has(value)) return false;
|
|
17125
17266
|
seen.add(value);
|
|
@@ -17133,6 +17274,7 @@ function withConsent(tool, text2, orders) {
|
|
|
17133
17274
|
return [
|
|
17134
17275
|
text2,
|
|
17135
17276
|
orders.some((o) => o.payment.url !== null) ? ORDER_NEXT_STEP : "",
|
|
17277
|
+
orders.some((o) => (o.payment.handlers?.length ?? 0) > 0) ? PAY_NEXT_STEP : "",
|
|
17136
17278
|
CANCEL_TOOLS.has(tool) && orders.some((o) => o.cancel?.available === true) ? CANCEL_NEXT_STEP : ""
|
|
17137
17279
|
].filter(Boolean).join("\n\n");
|
|
17138
17280
|
}
|
|
@@ -17140,7 +17282,7 @@ function withConsent(tool, text2, orders) {
|
|
|
17140
17282
|
// ../contract/package.json
|
|
17141
17283
|
var package_default = {
|
|
17142
17284
|
name: "@fortrip/agent-contract",
|
|
17143
|
-
version: "3.
|
|
17285
|
+
version: "3.4.0",
|
|
17144
17286
|
license: "Apache-2.0",
|
|
17145
17287
|
description: "The contract of Fortrip's agent API (https://api.fortrip.ai/v1) and its MCP server: limits, paths, request and response schemas, error codes and field rules.",
|
|
17146
17288
|
type: "module",
|
|
@@ -17226,6 +17368,9 @@ var API = {
|
|
|
17226
17368
|
},
|
|
17227
17369
|
orderCancel(id) {
|
|
17228
17370
|
return `/v1/orders/${encodeURIComponent(id)}/cancel`;
|
|
17371
|
+
},
|
|
17372
|
+
orderPay(id) {
|
|
17373
|
+
return `/v1/orders/${encodeURIComponent(id)}/pay`;
|
|
17229
17374
|
}
|
|
17230
17375
|
};
|
|
17231
17376
|
var MCP_PATH = "/";
|
package/dist/cli.js
CHANGED
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
unwrap,
|
|
26
26
|
usageError,
|
|
27
27
|
whoami
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-RXL4344N.js";
|
|
29
29
|
|
|
30
30
|
// src/commands.ts
|
|
31
31
|
import { readFileSync } from "fs";
|
|
@@ -168,7 +168,8 @@ var ROUTES = {
|
|
|
168
168
|
return text ? `${API.orders}?${text}` : API.orders;
|
|
169
169
|
}
|
|
170
170
|
},
|
|
171
|
-
cancel_order: { method: "POST", path: (input) => API.orderCancel(input.orderId) }
|
|
171
|
+
cancel_order: { method: "POST", path: (input) => API.orderCancel(input.orderId) },
|
|
172
|
+
pay_order: { method: "POST", path: (input) => API.orderPay(input.orderId) }
|
|
172
173
|
};
|
|
173
174
|
var PATH_FIELDS = /* @__PURE__ */ new Set(["hotelId", "orderId"]);
|
|
174
175
|
function parseOptions(spec, argv) {
|
|
@@ -363,6 +364,7 @@ function readFlag(flag, raw) {
|
|
|
363
364
|
case "stay.rooms":
|
|
364
365
|
return given.map(parseRoom);
|
|
365
366
|
case "filters.price.maxPerRoomNight":
|
|
367
|
+
case "total":
|
|
366
368
|
return { amount: given[0].trim(), currency: "USD" };
|
|
367
369
|
}
|
|
368
370
|
const parsed = given.map((value) => {
|
|
@@ -533,7 +535,7 @@ async function run(argv) {
|
|
|
533
535
|
case "mcp": {
|
|
534
536
|
parseOptions(spec, rest);
|
|
535
537
|
const mcpUrl = resolveMcpUrl(apiUrl);
|
|
536
|
-
const { runMcpBridge } = await import("./mcp-bridge-
|
|
538
|
+
const { runMcpBridge } = await import("./mcp-bridge-2QXRS5ZV.js");
|
|
537
539
|
await runMcpBridge(mcpUrl, apiUrl);
|
|
538
540
|
return void 0;
|
|
539
541
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fortrip",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.4.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "Search, price and book Fortrip hotels from the terminal or an AI agent.",
|
|
6
6
|
"mcpName": "io.github.FortripEngineering/fortrip",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"tsx": "^4.20.0",
|
|
33
33
|
"typescript": "^5.9.0",
|
|
34
34
|
"zod": "4.4.3",
|
|
35
|
-
"@fortrip/agent-contract": "3.
|
|
35
|
+
"@fortrip/agent-contract": "3.4.0"
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
|
38
38
|
"build": "tsup",
|