Skip to main content
Glama
variflight

Variflight Tripmatch MCP Server

Official
by variflight

getFlightPriceByCities

Retrieve flight prices by specifying departure and arrival cities using IATA codes and a departure date in YYYY-MM-DD format. Ideal for comparing airfare between specific locations.

Instructions

Get flight price information by departure city, arrival city, and departure date. All city codes must be valid IATA 3-letter codes (e.g. HFE for Hefei, CAN for Guangzhou). Date must be in YYYY-MM-DD format.

Input Schema

NameRequiredDescriptionDefault
arr_cityYesArrival city IATA 3-letter code (e.g. CAN for Guangzhou)
dep_cityYesDeparture city IATA 3-letter code (e.g. HFE for Hefei)
dep_dateYesDeparture date in YYYY-MM-DD format. 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

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": { "arr_city": { "description": "Arrival city IATA 3-letter code (e.g. CAN for Guangzhou)", "maxLength": 3, "minLength": 3, "pattern": "^[A-Z]{3}$", "type": "string" }, "dep_city": { "description": "Departure city IATA 3-letter code (e.g. HFE for Hefei)", "maxLength": 3, "minLength": 3, "pattern": "^[A-Z]{3}$", "type": "string" }, "dep_date": { "description": "Departure date in YYYY-MM-DD format. 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", "pattern": "^\\d{4}-\\d{2}-\\d{2}$", "type": "string" } }, "required": [ "dep_city", "arr_city", "dep_date" ], "type": "object" }

Implementation Reference

  • The MCP tool handler function that calls the OpenAlService to get flight prices by cities and returns the JSON-formatted response or an error message.
    }, async ({ dep_city, arr_city, dep_date }) => { try { const flightPrices = await flightService.getFlightPriceByCities(dep_city, arr_city, dep_date); return { content: [ { type: "text", text: JSON.stringify(flightPrices, null, 2) } ] }; } catch (error) { console.error('Error getting flight prices by cities:', error); return { content: [{ type: "text", text: `Error: ${error.message}` }], isError: true }; } });
  • Zod input schema defining parameters dep_city, arr_city, and dep_date with validation rules.
    dep_city: z.string() .length(3) .regex(/^[A-Z]{3}$/) .describe("Departure city IATA 3-letter code (e.g. HFE for Hefei)"), arr_city: z.string() .length(3) .regex(/^[A-Z]{3}$/) .describe("Arrival city IATA 3-letter code (e.g. CAN for Guangzhou)"), dep_date: z.string() .regex(/^\d{4}-\d{2}-\d{2}$/) .describe("Departure date in YYYY-MM-DD format. 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"),
  • dist/index.js:238-269 (registration)
    Complete registration of the getFlightPriceByCities tool with MCP server, including description, input schema, and handler.
    server.tool("getFlightPriceByCities", "Get flight price information by departure city, arrival city, and departure date. All city codes must be valid IATA 3-letter codes (e.g. HFE for Hefei, CAN for Guangzhou). Date must be in YYYY-MM-DD format.", { dep_city: z.string() .length(3) .regex(/^[A-Z]{3}$/) .describe("Departure city IATA 3-letter code (e.g. HFE for Hefei)"), arr_city: z.string() .length(3) .regex(/^[A-Z]{3}$/) .describe("Arrival city IATA 3-letter code (e.g. CAN for Guangzhou)"), dep_date: z.string() .regex(/^\d{4}-\d{2}-\d{2}$/) .describe("Departure date in YYYY-MM-DD format. 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"), }, async ({ dep_city, arr_city, dep_date }) => { try { const flightPrices = await flightService.getFlightPriceByCities(dep_city, arr_city, dep_date); return { content: [ { type: "text", text: JSON.stringify(flightPrices, null, 2) } ] }; } catch (error) { console.error('Error getting flight prices by cities:', error); return { content: [{ type: "text", text: `Error: ${error.message}` }], isError: true }; } });
  • Helper function in OpenAlService class that makes the underlying API request to the getFlightPriceByCities endpoint.
    async getFlightPriceByCities(dep_city, arr_city, dep_date) { return this.makeRequest('getFlightPriceByCities', { dep_city, arr_city, dep_date }); }

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/tripmatch-mcp'

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