Skip to main content
Glama
variflight

Variflight Tripmatch MCP Server

Official
by variflight

getFlightAndTrainTransferInfo

Find flight and train transfer options between cities using IATA airport codes and departure dates. Query transportation connections for multi-modal travel planning.

Instructions

Get flight and train transfer info by departure city and arrival city and departure date. Date format: YYYY-MM-DD. IMPORTANT: For today's date, you MUST use getTodayDate tool instead of hardcoding any date. Airport codes should be IATA 3-letter codes.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
depdateYesFlight 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
depcityYesDeparture airport IATA 3-letter code (e.g. BJS for Beijing, CAN for Guangzhou)
arrcityYesArrival airport IATA 3-letter code (e.g. SHA for Shanghai, LAX for Los Angeles)

Implementation Reference

  • The inline asynchronous handler function for the MCP tool 'getFlightAndTrainTransferInfo'. It calls OpenAlService.getTransferInfo and formats the JSON response or error.
    }, async ({ depcity, arrcity, depdate }) => { try { const flights = await flightService.getTransferInfo(depcity, arrcity, depdate); return { content: [ { type: "text", text: JSON.stringify(flights, null, 2) } ] }; } catch (error) { console.error('Error searching flights by number:', error); return { content: [{ type: "text", text: `Error: ${error.message}` }], isError: true }; } });
  • Zod input schema validation for the tool parameters: depdate, depcity, arrcity.
    depdate: z.string() .regex(/^\d{4}-\d{2}-\d{2}$/) .describe("Flight 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"), depcity: z.string() .length(3) .regex(/^[A-Z]{3}$/) .describe("Departure airport IATA 3-letter code (e.g. BJS for Beijing, CAN for Guangzhou)"), arrcity: z.string() .length(3) .regex(/^[A-Z]{3}$/) .describe("Arrival airport IATA 3-letter code (e.g. SHA for Shanghai, LAX for Los Angeles)"), }, async ({ depcity, arrcity, depdate }) => {
  • dist/index.js:95-95 (registration)
    The server.tool call that registers the 'getFlightAndTrainTransferInfo' tool with MCP server, providing name, description, schema, and handler.
    server.tool("getFlightAndTrainTransferInfo", "Get flight and train transfer info by departure city and arrival city and departure date. Date format: YYYY-MM-DD. IMPORTANT: For today's date, you MUST use getTodayDate tool instead of hardcoding any date. Airport codes should be IATA 3-letter codes. ", {
  • The OpenAlService method getTransferInfo that implements the core logic by making an API request to the 'transfer' endpoint.
    async getTransferInfo(depcity, arrcity, depdate) { return this.makeRequest('transfer', { depcity, arrcity, depdate, "fromMCP": 1 }); }
  • The base makeRequest method in OpenAlService used by getTransferInfo to call the external API.
    async makeRequest(endpoint, params) { const url = new URL(config.api.baseUrl); const request_body = { endpoint: endpoint, params: params }; const response = await fetch(url.toString(), { method: 'post', headers: { 'X-VARIFLIGHT-KEY': config.api.apiKey || '', 'Content-Type': 'application/json', }, body: JSON.stringify(request_body), }); if (!response.ok) { throw new Error(`API request failed: ${response.status} ${response.statusText}`); } return response.json(); }

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