Skip to main content
Glama
variflight

Variflight Tripmatch MCP Server

Official
by variflight

flightHappinessIndex

Analyze flight comfort and amenities by comparing punctuality, seat dimensions, baggage allowances, and health protocols for informed travel planning.

Instructions

using this tool when you need information related to following topics: Detailed flight comparisons (punctuality, amenities, cabin specs),Health safety protocols for air travel,Baggage allowance verification,Environmental impact assessments,Aircraft configuration visualization,Comfort-focused trip planning (seat dimensions, entertainment, food). etc.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fnumYesFlight number including airline code (e.g. MU2157, CZ3969)
dateYesFlight 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
depNoDeparture airport IATA 3-letter code (e.g. HFE for Hefei)
arrNoArrival airport IATA 3-letter code (e.g. CAN for Guangzhou)

Implementation Reference

  • The MCP tool handler function for 'flightHappinessIndex'. It receives input parameters, calls the flightService.getFlightHappinessIndex method, formats the response as JSON text content, and handles errors.
    }, async ({ fnum, date, dep, arr }) => { try { const flights = await flightService.getFlightHappinessIndex(fnum, date, dep, arr); 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-based input schema defining parameters fnum (flight number), date (YYYY-MM-DD), optional dep and arr (IATA codes) with validation rules and descriptions.
    fnum: z.string() .regex(/^[A-Z0-9]{2,3}[0-9]{1,4}$/) .describe("Flight number including airline code (e.g. MU2157, CZ3969)"), date: 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"), dep: z.string() .length(3) .regex(/^[A-Z]{3}$/) .describe("Departure airport IATA 3-letter code (e.g. HFE for Hefei)") .optional(), arr: z.string() .length(3) .regex(/^[A-Z]{3}$/) .describe("Arrival airport IATA 3-letter code (e.g. CAN for Guangzhou)") .optional(),
  • dist/index.js:128-164 (registration)
    Registration of the 'flightHappinessIndex' MCP tool, including name, description, input schema, and handler function.
    server.tool("flightHappinessIndex", "using this tool when you need information related to following topics: Detailed flight comparisons (punctuality, amenities, cabin specs),Health safety protocols for air travel,Baggage allowance verification,Environmental impact assessments,Aircraft configuration visualization,Comfort-focused trip planning (seat dimensions, entertainment, food). etc.", { fnum: z.string() .regex(/^[A-Z0-9]{2,3}[0-9]{1,4}$/) .describe("Flight number including airline code (e.g. MU2157, CZ3969)"), date: 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"), dep: z.string() .length(3) .regex(/^[A-Z]{3}$/) .describe("Departure airport IATA 3-letter code (e.g. HFE for Hefei)") .optional(), arr: z.string() .length(3) .regex(/^[A-Z]{3}$/) .describe("Arrival airport IATA 3-letter code (e.g. CAN for Guangzhou)") .optional(), }, async ({ fnum, date, dep, arr }) => { try { const flights = await flightService.getFlightHappinessIndex(fnum, date, dep, arr); 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 }; } });
  • Helper method in OpenAlService class that constructs API parameters and calls the 'happiness' endpoint via makeRequest to retrieve the flight happiness index data.
    async getFlightHappinessIndex(fnum, date, dep, arr) { const params = { fnum, date, }; if (dep) params.dep = dep; if (arr) params.arr = arr; return this.makeRequest('happiness', params); }

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