searchFlightItineraries
Find purchasable flight options and lowest prices by entering departure and arrival city codes (e.g., BJS for Beijing) along with the departure date (YYYY-MM-DD).
Instructions
Search for purchasable flight options and the lowest price using the departure city three-letter code, arrival city three-letter code, and departure date. (e.g. BJS for Beijing, SHA for Shanghai, CAN for Guangzhou, HFE for Hefei).
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| arrCityCode | Yes | Arrival city 3-letter code (e.g. BJS for Beijing, SHA for Shanghai, CAN for Guangzhou, HFE for Hefei) | |
| depCityCode | Yes | Departure city 3-letter code (e.g. BJS for Beijing, SHA for Shanghai, CAN for Guangzhou, HFE for Hefei) | |
| depDate | Yes | Departure city date (format: YYYY-MM-DD, e.g., 2025-07-04).IMPORTANT: If user input only cotains month and date, you should use getTodayDate tool to get the year. For today's date, use getTodayDate tool instead of hardcoding |
Implementation Reference
- dist/index.js:246-265 (handler)The inline handler function registered for the 'searchFlightItineraries' tool. It invokes the flightService method and returns the JSON-formatted response or an error.}, async ({ depCityCode, depDate, arrCityCode }) => { try { const flightItineraries = await flightService.searchFlightItineraries(depCityCode, arrCityCode, depDate); return { content: [ { type: "text", text: JSON.stringify(flightItineraries, null, 2) } ] }; } catch (error) { console.error('Error getting airport weather:', error); return { content: [{ type: "text", text: `Error: ${error.message}` }], isError: true }; } });
- dist/index.js:237-245 (schema)Zod input schema validation for the tool parameters: depCityCode, depDate, arrCityCode.depCityCode: z.string() .regex(/^[A-Z]{3}$/) .describe("Departure city 3-letter code (e.g. BJS for Beijing, SHA for Shanghai, CAN for Guangzhou, HFE for Hefei)"), depDate: z.string() .regex(/^\d{4}-\d{2}-\d{2}$/) .describe("Departure city date (format: YYYY-MM-DD, e.g., 2025-07-04).IMPORTANT: If user input only cotains month and date, you should use getTodayDate tool to get the year. For today's date, use getTodayDate tool instead of hardcoding"), arrCityCode: z.string() .regex(/^[A-Z]{3}$/) .describe("Arrival city 3-letter code (e.g. BJS for Beijing, SHA for Shanghai, CAN for Guangzhou, HFE for Hefei)"),
- dist/index.js:236-246 (registration)The registration of the 'searchFlightItineraries' tool on the MCP server, including description and schema.server.tool('searchFlightItineraries', 'Search for purchasable flight options and the lowest price using the departure city three-letter code, arrival city three-letter code, and departure date. (e.g. BJS for Beijing, SHA for Shanghai, CAN for Guangzhou, HFE for Hefei).', { depCityCode: z.string() .regex(/^[A-Z]{3}$/) .describe("Departure city 3-letter code (e.g. BJS for Beijing, SHA for Shanghai, CAN for Guangzhou, HFE for Hefei)"), depDate: z.string() .regex(/^\d{4}-\d{2}-\d{2}$/) .describe("Departure city date (format: YYYY-MM-DD, e.g., 2025-07-04).IMPORTANT: If user input only cotains month and date, you should use getTodayDate tool to get the year. For today's date, use getTodayDate tool instead of hardcoding"), arrCityCode: z.string() .regex(/^[A-Z]{3}$/) .describe("Arrival city 3-letter code (e.g. BJS for Beijing, SHA for Shanghai, CAN for Guangzhou, HFE for Hefei)"), }, async ({ depCityCode, depDate, arrCityCode }) => {
- dist/services/openalService.js:72-78 (helper)Helper method in OpenAlService class that performs the actual API request to the 'searchFlightItineraries' endpoint.async searchFlightItineraries(depCityCode, arrCityCode, depDate) { return this.makeRequest('searchFlightItineraries', { "depCityCode": depCityCode, "arrCityCode": arrCityCode, "depDate": depDate }); }
- dist/services/openalService.d.ts:9-9 (schema)TypeScript type definition for the searchFlightItineraries method in OpenAlService.searchFlightItineraries(depCityCode: string, arrCityCode: string, depDate: string): Promise<any>;