get_airport_info_light
Retrieve airport details including name, ICAO, and IATA codes by providing an airport code to access aviation information from Flightradar24 data.
Instructions
Returns airport name, ICAO and IATA codes. 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:422-442 (handler)The handler function that executes the tool logic: destructures the 'code' param, fetches airport info via FR24Client, returns formatted JSON text or error.async (params: z.infer<typeof airportInfoLightSchema>) => { const { code } = params; try { console.log(`Raw params received by handler: ${JSON.stringify(params)}`); const airport = await fr24Client.getAirportInfoLight(code); return { content: [{ type: 'text' as const, text: `Airport information (light):\n${JSON.stringify(airport, null, 2)}` }] }; } catch (error) { return { content: [{ type: 'text' as const, text: `Error fetching light airport info for ${code}: ${error instanceof Error ? error.message : 'Unknown error'}` }], isError: true }; } }
- src/server.ts:94-94 (schema)Zod input schema defining the required 'code' parameter for the tool.const airportInfoLightSchema = z.object({ code: z.string().min(1).describe('Airport IATA or ICAO code.') });
- src/server.ts:418-443 (registration)Registration of the tool using McpServer.tool() with name, description, schema, and handler.server.tool( 'get_airport_info_light', 'Returns airport name, ICAO and IATA codes. REQUIRED: code must be provided and non-empty.', airportInfoLightSchema.shape, async (params: z.infer<typeof airportInfoLightSchema>) => { const { code } = params; try { console.log(`Raw params received by handler: ${JSON.stringify(params)}`); const airport = await fr24Client.getAirportInfoLight(code); return { content: [{ type: 'text' as const, text: `Airport information (light):\n${JSON.stringify(airport, null, 2)}` }] }; } catch (error) { return { content: [{ type: 'text' as const, text: `Error fetching light airport info for ${code}: ${error instanceof Error ? error.message : 'Unknown error'}` }], isError: true }; } } );
- src/fr24-client.ts:130-132 (helper)Helper method in FR24Client that makes the API request to fetch light airport information.async getAirportInfoLight(code: string): Promise<AirportInfoLight> { return this.makeRequest<AirportInfoLight>(`/static/airports/${code}/light`); }
- src/types.ts:64-68 (schema)TypeScript interface defining the structure of the AirportInfoLight output.export interface AirportInfoLight { name: string; iata: string; icao: string; }