google-flights-mcp-server 0.1.2 → 0.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/package.json
CHANGED
|
@@ -361,6 +361,10 @@ export async function searchFlights(options) {
|
|
|
361
361
|
let allOffers = parseFlightOffers(ds1, options.currency);
|
|
362
362
|
// Apply client-side stop filter (supplements the protobuf filter)
|
|
363
363
|
allOffers = filterByStops(allOffers, options.max_stops);
|
|
364
|
+
// Filter out basic economy fares (fare_brand "Economy" = tier 1, the lowest/basic tier)
|
|
365
|
+
if (options.exclude_basic_economy) {
|
|
366
|
+
allOffers = allOffers.filter((o) => o.fare_brand !== 'Economy');
|
|
367
|
+
}
|
|
364
368
|
// Sort
|
|
365
369
|
allOffers = sortOffers(allOffers, options.sort_by);
|
|
366
370
|
const totalResults = allOffers.length;
|
|
@@ -17,6 +17,7 @@ export declare const SearchFlightsSchema: z.ZodObject<{
|
|
|
17
17
|
max_results: z.ZodDefault<z.ZodNumber>;
|
|
18
18
|
offset: z.ZodDefault<z.ZodNumber>;
|
|
19
19
|
currency: z.ZodDefault<z.ZodString>;
|
|
20
|
+
exclude_basic_economy: z.ZodDefault<z.ZodBoolean>;
|
|
20
21
|
}, "strip", z.ZodTypeAny, {
|
|
21
22
|
sort_by: "best" | "price" | "duration" | "departure" | "arrival";
|
|
22
23
|
max_stops: "any" | "nonstop" | "1" | "2";
|
|
@@ -32,6 +33,7 @@ export declare const SearchFlightsSchema: z.ZodObject<{
|
|
|
32
33
|
infants_on_lap: number;
|
|
33
34
|
max_results: number;
|
|
34
35
|
offset: number;
|
|
36
|
+
exclude_basic_economy: boolean;
|
|
35
37
|
return_date?: string | undefined;
|
|
36
38
|
}, {
|
|
37
39
|
origin: string;
|
|
@@ -49,6 +51,7 @@ export declare const SearchFlightsSchema: z.ZodObject<{
|
|
|
49
51
|
infants_on_lap?: number | undefined;
|
|
50
52
|
max_results?: number | undefined;
|
|
51
53
|
offset?: number | undefined;
|
|
54
|
+
exclude_basic_economy?: boolean | undefined;
|
|
52
55
|
}>;
|
|
53
56
|
export declare function searchFlightsTool(_server: Server, clientFactory: FlightsClientFactory): {
|
|
54
57
|
name: string;
|
|
@@ -120,6 +123,10 @@ export declare function searchFlightsTool(_server: Server, clientFactory: Flight
|
|
|
120
123
|
type: string;
|
|
121
124
|
description: string;
|
|
122
125
|
};
|
|
126
|
+
exclude_basic_economy: {
|
|
127
|
+
type: string;
|
|
128
|
+
description: string;
|
|
129
|
+
};
|
|
123
130
|
};
|
|
124
131
|
required: string[];
|
|
125
132
|
};
|
|
@@ -57,6 +57,10 @@ export const SearchFlightsSchema = z.object({
|
|
|
57
57
|
.max(3)
|
|
58
58
|
.default('USD')
|
|
59
59
|
.describe('Currency code for prices (e.g., "USD", "EUR", "GBP")'),
|
|
60
|
+
exclude_basic_economy: z
|
|
61
|
+
.boolean()
|
|
62
|
+
.default(true)
|
|
63
|
+
.describe('Exclude basic economy fares from results (default: true). Basic economy fares typically have restrictions like no carry-on, no seat selection, and no changes. Set to false to include all fare tiers.'),
|
|
60
64
|
});
|
|
61
65
|
export function searchFlightsTool(_server, clientFactory) {
|
|
62
66
|
return {
|
|
@@ -67,6 +71,8 @@ Returns structured flight data including prices, airlines, times, durations, sto
|
|
|
67
71
|
|
|
68
72
|
The fare_brand field indicates the fare tier: "Economy" (basic/lowest tier), "Economy+" (mid-tier with extras), or "Economy Flex" (higher tier with more flexibility). This is derived from Google's numeric fare tier data and may be null if unavailable. Use the extensions field (carry_on_included, checked_bags_included) for concrete amenity details.
|
|
69
73
|
|
|
74
|
+
By default, basic economy fares (fare_brand "Economy") are excluded from results since they typically have significant restrictions (no carry-on, no seat selection, non-refundable). Set exclude_basic_economy to false to include all fare tiers.
|
|
75
|
+
|
|
70
76
|
IMPORTANT — Handling large result sets: Popular routes often return 50-150+ flights. If total_results is high, recommend narrowing with filters (max_stops, sort_by, seat_class) rather than paginating through everything. For example, set max_stops to "nonstop" or sort_by to "price" to surface the most relevant options quickly.
|
|
71
77
|
|
|
72
78
|
Pagination: The response includes has_more (boolean) and next_offset (number or null). To get the next page, call search_flights again with the same parameters but set offset to next_offset. Keep paginating while has_more is true. Each page returns up to max_results flights.
|
|
@@ -137,6 +143,10 @@ Use get_date_grid to find the cheapest dates before searching.`,
|
|
|
137
143
|
type: 'string',
|
|
138
144
|
description: 'Currency code for prices (default: USD)',
|
|
139
145
|
},
|
|
146
|
+
exclude_basic_economy: {
|
|
147
|
+
type: 'boolean',
|
|
148
|
+
description: 'Exclude basic economy fares (default: true). Set to false to include all fare tiers.',
|
|
149
|
+
},
|
|
140
150
|
},
|
|
141
151
|
required: ['origin', 'destination', 'departure_date'],
|
|
142
152
|
},
|