get_airport_info_full
Retrieve comprehensive airport details including full name, codes, location, elevation, country, city, state, and timezone information using IATA or ICAO airport codes.
Instructions
Returns detailed airport information: full name, ICAO and IATA codes, localization, elevation, country, city, state, timezone details. REQUIRED: code must be provided and non-empty.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | Airport IATA or ICAO code. |
Implementation Reference
- src/server.ts:445-470 (handler)Primary MCP tool handler and registration for 'get_airport_info_full'. Extracts airport code from params, fetches data via FR24Client, formats and returns as text content, handles errors.server.tool( 'get_airport_info_full', 'Returns detailed airport information: full name, ICAO and IATA codes, localization, elevation, country, city, state, timezone details. REQUIRED: code must be provided and non-empty.', airportInfoFullSchema.shape, async (params: z.infer<typeof airportInfoFullSchema>) => { const { code } = params; try { console.log(`Raw params received by handler: ${JSON.stringify(params)}`); const airport = await fr24Client.getAirportInfoFull(code); return { content: [{ type: 'text' as const, text: `Airport information (full):\n${JSON.stringify(airport, null, 2)}` }] }; } catch (error) { return { content: [{ type: 'text' as const, text: `Error fetching full airport info for ${code}: ${error instanceof Error ? error.message : 'Unknown error'}` }], isError: true }; } } );
- src/fr24-client.ts:135-137 (handler)FR24Client method implementing the core API call for full airport information.async getAirportInfoFull(code: string): Promise<AirportFullInfo> { return this.makeRequest<AirportFullInfo>(`/static/airports/${ code}/full`); }
- src/server.ts:95-95 (schema)Zod input schema validation for the tool parameters.const airportInfoFullSchema = z.object({ code: z.string().min(1).describe('Airport IATA or ICAO code.') });
- src/types.ts:78-89 (schema)TypeScript interface defining the structure of full airport information returned by the API.export interface AirportFullInfo { name: string; iata: string; icao: string; lon: number; lat: number; elevation: number; country: CountryInfo; city: string; state: string | null; timezone: TimezoneInfo; }
- src/fr24-client.ts:32-62 (helper)Generic HTTP request helper method used by getAirportInfoFull to make authenticated API calls to Flightradar24.private async makeRequest<T>(endpoint: string, params?: Record<string, any>): Promise<T> { try { console.log(`Making request to ${endpoint} with params: ${JSON.stringify(params)}`); const response = await axios.get(`${this.baseUrl}${endpoint}`, { params: params, headers: { 'Accept': 'application/json', 'Accept-Version': 'v1', 'Authorization': `Bearer ${this.apiKey}` } }); // Handle responses nested under 'data' key, except for count endpoints and single objects if (response.data && response.data.data && Array.isArray(response.data.data)) { return response.data.data as T; } // Handle count responses if (response.data && typeof response.data.record_count === 'number') { return response.data as T; } // Handle single object responses (like flight tracks, airport info, airline info) if (response.data && typeof response.data === 'object' && !Array.isArray(response.data)) { return response.data as T; } // Fallback for unexpected structure return response.data as T; } catch (error) { const message = error instanceof AxiosError ? error.message : 'Unknown error'; console.error(`API Request Failed: ${endpoint}`, error); throw new Error(`Failed request to ${endpoint}: ${message}`); } }