get_flight_eta
Retrieve the estimated arrival time for a flight by providing its flight number. Helps track when a flight will land.
Instructions
Get estimated arrival time for a specific flight
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| flightNumber | Yes | Flight number (e.g., UA123) |
Implementation Reference
- src/index.ts:137-164 (handler)The main handler for the 'get_flight_eta' tool. It extracts the flightNumber from arguments, validates it against the pattern /^[A-Z0-9]{2,8}$/, calls the FR24 API at /api/flights/detail with format='eta', and returns the response as text content.
case 'get_flight_eta': { const { flightNumber } = toolArgs || {}; const flightNumberStr = String(flightNumber || ''); if (!flightNumberStr || !/^[A-Z0-9]{2,8}$/.test(flightNumberStr)) { throw new McpError( ErrorCode.InvalidParams, 'Invalid flight number format' ); } const response = await fr24Client.get<FlightETAResponse>( '/api/flights/detail', { params: { flight: flightNumberStr, format: 'eta' } } ); return { content: [{ type: "text", text: JSON.stringify(response.data, null, 2) }] }; } - src/index.ts:87-100 (registration)Tool registration in the ListToolsRequestSchema handler. Defines the tool name 'get_flight_eta', description, and inputSchema (requires flightNumber string with pattern ^[A-Z0-9]{2,8}$).
{ name: 'get_flight_eta', description: 'Get estimated arrival time for a specific flight', inputSchema: { type: 'object', properties: { flightNumber: { type: 'string', description: 'Flight number (e.g., UA123)', pattern: '^[A-Z0-9]{2,8}$' } }, required: ['flightNumber'] } - src/types.ts:54-56 (schema)Type definition for FlightETAResponse, which wraps the FlightETA type used as the API response type.
export interface FlightETAResponse { data: FlightETA; } - src/types.ts:37-52 (schema)Type definition for FlightETA - the data structure returned by the ETA tool, including flight_number, departure/arrival info (airport, scheduled, actual/estimated times, delay), and status.
export interface FlightETA { flight_number: string; departure: { airport: string; scheduled: string; actual: string; delay?: number; }; arrival: { airport: string; scheduled: string; estimated: string; delay?: number; }; status: 'scheduled' | 'active' | 'landed' | 'cancelled'; }