Skip to main content
Glama

get_airline_info

Retrieve airline details including name, ICAO, and IATA codes by providing a valid ICAO code. This tool helps identify airlines from their codes within flight tracking systems.

Instructions

Returns airline name, ICAO and IATA codes. REQUIRED: icao code must be provided and non-empty.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
icaoYesAirline ICAO code.

Implementation Reference

  • The MCP tool handler function for 'get_airline_info'. It extracts the ICAO code from input parameters, fetches the airline information using FR24Client, formats the response as text content, and handles errors appropriately.
    async (params: z.infer<typeof airlineInfoSchema>) => { const { icao } = params; try { console.log(`Raw params received by handler: ${JSON.stringify(params)}`); const airline = await fr24Client.getAirlineInfo(icao); return { content: [{ type: 'text' as const, text: `Airline information (light):\n${JSON.stringify(airline, null, 2)}` }] }; } catch (error) { return { content: [{ type: 'text' as const, text: `Error fetching airline info for ${icao}: ${error instanceof Error ? error.message : 'Unknown error'}` }], isError: true }; } }
  • src/server.ts:391-416 (registration)
    Registration of the 'get_airline_info' tool on the McpServer instance, specifying name, description, input schema, and handler function.
    server.tool( 'get_airline_info', 'Returns airline name, ICAO and IATA codes. REQUIRED: icao code must be provided and non-empty.', airlineInfoSchema.shape, async (params: z.infer<typeof airlineInfoSchema>) => { const { icao } = params; try { console.log(`Raw params received by handler: ${JSON.stringify(params)}`); const airline = await fr24Client.getAirlineInfo(icao); return { content: [{ type: 'text' as const, text: `Airline information (light):\n${JSON.stringify(airline, null, 2)}` }] }; } catch (error) { return { content: [{ type: 'text' as const, text: `Error fetching airline info for ${icao}: ${error instanceof Error ? error.message : 'Unknown error'}` }], isError: true }; } } );
  • Zod schema defining the input parameters for the 'get_airline_info' tool: a required 'icao' string.
    const airlineInfoSchema = z.object({ icao: z.string().min(1).describe('Airline ICAO code.') });
  • Helper method in FR24Client class that makes the API request to retrieve airline information from the Flightradar24 API endpoint.
    async getAirlineInfo(icao: string): Promise<AirlineInfo> { return this.makeRequest<AirlineInfo>(`/static/airlines/${icao}/light`); }
  • TypeScript interface defining the structure of the AirlineInfo response object used by the tool.
    export interface AirlineInfo { icao: string; iata: string; name: string; }

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/BACH-AI-Tools/fr24api-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server