Skip to main content
Glama
variflight
by variflight

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
NameRequiredDescriptionDefault
arrCityCodeYesArrival city 3-letter code (e.g. BJS for Beijing, SHA for Shanghai, CAN for Guangzhou, HFE for Hefei)
depCityCodeYesDeparture city 3-letter code (e.g. BJS for Beijing, SHA for Shanghai, CAN for Guangzhou, HFE for Hefei)
depDateYesDeparture 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

  • 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 }; } });
  • 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 }) => {
  • 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 }); }
  • TypeScript type definition for the searchFlightItineraries method in OpenAlService.
    searchFlightItineraries(depCityCode: string, arrCityCode: string, depDate: string): Promise<any>;

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/variflight/variflight-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server