@fortrip/agent-contract 6.1.0 → 6.2.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/dist/index.d.ts +5 -2
- package/dist/index.js +18 -14
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -2742,8 +2742,11 @@ declare const RATE_LIMITS: Record<RateLimitName, {
|
|
|
2742
2742
|
|
|
2743
2743
|
/** The error envelope as text; `status` is the HTTP status, when known.
|
|
2744
2744
|
* `surface` names the next calls: tools (`mcp`, the default) or commands
|
|
2745
|
-
* (`cli`).
|
|
2746
|
-
|
|
2745
|
+
* (`cli`). `options.tokenPay: false`, for a client not offered payment by
|
|
2746
|
+
* token: no line names one. */
|
|
2747
|
+
declare function renderError(envelope: unknown, status?: number, surface?: RenderSurface, options?: {
|
|
2748
|
+
tokenPay?: boolean;
|
|
2749
|
+
}): string;
|
|
2747
2750
|
|
|
2748
2751
|
type RenderedTool = ToolName;
|
|
2749
2752
|
/**
|
package/dist/index.js
CHANGED
|
@@ -337,7 +337,9 @@ var destination = z5.discriminatedUnion(
|
|
|
337
337
|
radiusMeters
|
|
338
338
|
}),
|
|
339
339
|
strictInput({
|
|
340
|
-
kind: z5.literal("point", { error: "kind must be point" }).describe(
|
|
340
|
+
kind: z5.literal("point", { error: "kind must be point" }).describe(
|
|
341
|
+
"A point the user asked to stay near: a landmark or an address they named, or the coordinates hotel details showed. Never a position the user did not give."
|
|
342
|
+
),
|
|
341
343
|
location: strictInput({
|
|
342
344
|
lat: bounded("lat", -90, 90).describe("Latitude, WGS84."),
|
|
343
345
|
lng: bounded("lng", -180, 180).describe("Longitude, WGS84.")
|
|
@@ -2399,7 +2401,7 @@ var TOOLS = [
|
|
|
2399
2401
|
{
|
|
2400
2402
|
name: "search_hotels",
|
|
2401
2403
|
title: "Search hotels",
|
|
2402
|
-
description: "
|
|
2404
|
+
description: "Use this when the user wants hotels in a place they name, or a hotel by its name or brand. It finds hotels by destination and/or text, with an indicative per-room-night price when a stay is given. destination is the place the user asked for, never a location they did not give: a place_name with its countryCode, a place or locality by placeId from an earlier answer, a point (a landmark or an address the user named, or the coordinates hotel details showed), or a country. text matches hotel names, brands and areas word for word. Indicative prices are estimates and not bookable: get_hotel_offers returns what the user pays. A name several places bear answers destination_ambiguous, and a search too broad to price answers search_too_broad with its localities; each error says what to do next. The answer states what was searched, the counts and notes; a next page is the cursor and, optionally, limit.",
|
|
2403
2405
|
annotations: READ,
|
|
2404
2406
|
input: searchHotelsInput,
|
|
2405
2407
|
output: searchResult
|
|
@@ -2407,7 +2409,7 @@ var TOOLS = [
|
|
|
2407
2409
|
{
|
|
2408
2410
|
name: "get_hotel",
|
|
2409
2411
|
title: "Hotel details",
|
|
2410
|
-
description: `
|
|
2412
|
+
description: `Use this when the user asks about one hotel itself: where it is, its check-in and check-out times, its policies, amenities or room types. It returns the hotel's catalogue facts: names, address, coordinates, time zone, check-in and check-out times, the full description, every policy and the amenities, and its room types with include: "roomTypes". "Not listed" is not "no". No prices or availability: get_hotel_offers has those.`,
|
|
2411
2413
|
annotations: READ,
|
|
2412
2414
|
input: getHotelInput,
|
|
2413
2415
|
output: hotel
|
|
@@ -2415,7 +2417,7 @@ var TOOLS = [
|
|
|
2415
2417
|
{
|
|
2416
2418
|
name: "get_hotel_offers",
|
|
2417
2419
|
title: "Live offers",
|
|
2418
|
-
description: `
|
|
2420
|
+
description: `Use this when the user wants what a stay really costs or whether it can be booked, at hotels already found, and before create_order. It returns live, bookable offers for up to ${LIMITS.offersHotels} hotels and one stay. Every room in stay.rooms must have the same party: for different parties, call once per party. Each offer has the room type, the meals included, the total, in the request's currency, for the whole stay and every room (what is charged), with its average per room-night for comparison, fees payable at the property, the cancellation terms with times in UTC and the hotel's time zone, the confirmation mode, and an offerId for create_order with the time it expires. Hotels with nothing to offer are listed as unavailable with the reason. Up to limitPerHotel offers per hotel (default ${LIMITS.offersPerHotelDefault}, fewer when the call's hotels share its ${LIMITS.offersPerCallDefault} offers), picked to span price, free cancellation, breakfast and rooms, listed cheapest first; the answer says, per hotel, how many more a call for that hotel alone would show.`,
|
|
2419
2421
|
annotations: READ,
|
|
2420
2422
|
input: hotelOffersInput,
|
|
2421
2423
|
output: hotelOffersResult
|
|
@@ -2423,7 +2425,7 @@ var TOOLS = [
|
|
|
2423
2425
|
{
|
|
2424
2426
|
name: "create_order",
|
|
2425
2427
|
title: "Create order",
|
|
2426
|
-
description: `Create an unpaid order
|
|
2428
|
+
description: `Create an unpaid order when the user asks to book one offer from get_hotel_offers. It takes items, one item with the offer's offerId inside it (nowhere else in the arguments) and hotel.rooms, and contact. The answer is the order, awaiting payment: its reference, the total, the stay and its terms, and a payment link, a Fortrip page to pay on. Nothing is charged until the order is paid${PAID_WHERE}; 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: another order of the stay (another party, or a corrected guest name or contact) takes a new offer. cancel_order cancels or closes an order; for changes, or a cancellation it can't make, the user emails ${SUPPORT_EMAIL} with the order's reference.`,
|
|
2427
2429
|
// Destructive: Claude's connector review asks `destructiveHint: true`
|
|
2428
2430
|
// "for tools that modify or delete data", and a per-call confirmation
|
|
2429
2431
|
// before an order is created is the behaviour wanted. Idempotent: the
|
|
@@ -2440,7 +2442,7 @@ var TOOLS = [
|
|
|
2440
2442
|
{
|
|
2441
2443
|
name: "get_order",
|
|
2442
2444
|
title: "Get order",
|
|
2443
|
-
description: "
|
|
2445
|
+
description: "Use this when the user asks about one order of theirs: whether it is paid or confirmed, its terms, or what cancelling it would cost. It returns the order by orderId: its status, the payment status and, while it awaits payment, its payment link; the stay, its guests and its terms; whether it can be cancelled now, for which penalty and refund, or closed; why a failed order booked nothing and what a cancellation kept; and the hotel's confirmation number once there is one. It shows whether a payment went through.",
|
|
2444
2446
|
annotations: READ_OWN,
|
|
2445
2447
|
input: getOrderInput,
|
|
2446
2448
|
output: order
|
|
@@ -2448,7 +2450,7 @@ var TOOLS = [
|
|
|
2448
2450
|
{
|
|
2449
2451
|
name: "list_orders",
|
|
2450
2452
|
title: "List orders",
|
|
2451
|
-
description: "
|
|
2453
|
+
description: "Use this when the user asks what they have booked, or about an order whose orderId you do not have. It returns the user's hotel orders, newest first, including those made on the Fortrip website, each as get_order shows it. A next page is the cursor the answer gives.",
|
|
2452
2454
|
annotations: READ_OWN,
|
|
2453
2455
|
input: listOrdersInput,
|
|
2454
2456
|
output: orderList
|
|
@@ -2456,7 +2458,7 @@ var TOOLS = [
|
|
|
2456
2458
|
{
|
|
2457
2459
|
name: "cancel_order",
|
|
2458
2460
|
title: "Cancel order",
|
|
2459
|
-
description: "
|
|
2461
|
+
description: "Use this when the user asks to cancel a paid order or to close an unpaid one. It cancels a paid order under its terms, or closes an unpaid one. It takes the orderId and exactly one of maximumPenalty (a paid order) and close: true (an unpaid one). Paid (the order's Cancel line says it can be cancelled): pass maximumPenalty, the penalty on that line exactly as shown. The order becomes cancelling, then cancelled with the refund on its way, or confirmed again if the hotel refuses. If the penalty rose above maximumPenalty, the answer is cancellation_changed and nothing changed. Unpaid (the Cancel line says it can be closed): close: true closes it: nothing is charged, and it can no longer be paid. A mode that does not fit the order (close on an order paid meanwhile) answers order_not_cancellable, which says which mode applies now or what blocks both: nothing is cancelled or closed by the other mode. While a payment is under way the answer is payment_in_progress. The same call again answers the order as it is.",
|
|
2460
2462
|
annotations: {
|
|
2461
2463
|
readOnlyHint: false,
|
|
2462
2464
|
idempotentHint: true,
|
|
@@ -3664,7 +3666,7 @@ function notCancellable(d, surface) {
|
|
|
3664
3666
|
ours`This order can be neither cancelled nor closed now: ${blockerText(c)}.`
|
|
3665
3667
|
];
|
|
3666
3668
|
}
|
|
3667
|
-
function detailLines(e, surface) {
|
|
3669
|
+
function detailLines(e, surface, tokenPay) {
|
|
3668
3670
|
const getOrder = (id) => surface === "cli" ? ours`\`fortrip orders get ${id}\`` : ours`get_order`;
|
|
3669
3671
|
switch (e.code) {
|
|
3670
3672
|
case "invalid_request": {
|
|
@@ -3769,7 +3771,7 @@ function detailLines(e, surface) {
|
|
|
3769
3771
|
];
|
|
3770
3772
|
case "service_unavailable":
|
|
3771
3773
|
return [
|
|
3772
|
-
ours`Retry once with the same details (a payment with the same token, never a new one); if it fails again, tell the user.`
|
|
3774
|
+
tokenPay ? ours`Retry once with the same details (a payment with the same token, never a new one); if it fails again, tell the user.` : ours`Retry once with the same details; if it fails again, tell the user.`
|
|
3773
3775
|
];
|
|
3774
3776
|
case "supplier_unavailable":
|
|
3775
3777
|
return [
|
|
@@ -3790,7 +3792,7 @@ function retryLine(retryable, after) {
|
|
|
3790
3792
|
}
|
|
3791
3793
|
return retryable === false ? ours`Not retryable.` : ours`Retryable: unknown.`;
|
|
3792
3794
|
}
|
|
3793
|
-
function renderError(envelope, status, surface = "mcp") {
|
|
3795
|
+
function renderError(envelope, status, surface = "mcp", options = {}) {
|
|
3794
3796
|
let known = null;
|
|
3795
3797
|
let body = null;
|
|
3796
3798
|
try {
|
|
@@ -3815,9 +3817,11 @@ function renderError(envelope, status, surface = "mcp") {
|
|
|
3815
3817
|
retryLine(body.retryable, body.retryAfterSeconds)
|
|
3816
3818
|
];
|
|
3817
3819
|
if (typeof body.pointer === "string") lines.push(ours`Field: ${token("pointer", body.pointer)}`);
|
|
3818
|
-
if (known) lines.push(...detailLines(known, surface));
|
|
3820
|
+
if (known) lines.push(...detailLines(known, surface, options.tokenPay !== false));
|
|
3819
3821
|
else if (body.details !== void 0) lines.push(ours`Details: ${raw(body.details)}`);
|
|
3820
|
-
if (typeof body.requestId === "string"
|
|
3822
|
+
if (typeof body.requestId === "string" && (surface === "cli" || body.code === "internal")) {
|
|
3823
|
+
lines.push(ours`Request id: ${token("id", body.requestId)}`);
|
|
3824
|
+
}
|
|
3821
3825
|
return lines.join("\n");
|
|
3822
3826
|
}
|
|
3823
3827
|
|
|
@@ -3981,7 +3985,7 @@ var ME_SCOPES = { email: "email", name: "profile" };
|
|
|
3981
3985
|
// package.json
|
|
3982
3986
|
var package_default = {
|
|
3983
3987
|
name: "@fortrip/agent-contract",
|
|
3984
|
-
version: "6.
|
|
3988
|
+
version: "6.2.0",
|
|
3985
3989
|
license: "Apache-2.0",
|
|
3986
3990
|
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.",
|
|
3987
3991
|
type: "module",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fortrip/agent-contract",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.2.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"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.",
|
|
6
6
|
"type": "module",
|