Skip to main content
Glama
BACH-AI-Tools

Flightradar24 MCP Server

get_flight_tracks

Retrieve positional track data for a specific flight using its Flightradar24 ID to monitor its route and location history.

Instructions

Returns positional tracks of a specific flight. REQUIRED: flight_id must be provided and non-empty.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
flight_idYesFlightradar24 ID of the flight (hexadecimal).

Implementation Reference

  • The MCP tool handler function for 'get_flight_tracks'. It receives parameters, calls FR24Client.getFlightTracks, formats the response with flight ID and JSON stringified tracks, or returns an error message.
    flightTracksSchema.shape,
    async (params: z.infer<typeof flightTracksSchema>) => {
      try {
        console.log(`Raw params received by handler: ${JSON.stringify(params)}`);
        const result = await fr24Client.getFlightTracks(params);
        const flightId = Array.isArray(result) && result.length > 0 ? result[0].fr24_id : 'unknown';
        return {
          content: [{
            type: 'text' as const,
            text: `Found track points for flight ${flightId}:\n${JSON.stringify(result, null, 2)}`
          }]
        };
      } catch (error) {
        return {
          content: [{
            type: 'text' as const,
            text: `Error: ${error instanceof Error ? error.message : 'Unknown error'}`
          }],
          isError: true
        };
      }
    }
  • Zod input schema for the 'get_flight_tracks' tool, validating a required 'flight_id' string parameter.
    const flightTracksSchema = z.object({
      flight_id: z.string().min(1).describe('Flightradar24 ID of the flight (hexadecimal).')
    });
  • src/server.ts:364-389 (registration)
    Registration of the 'get_flight_tracks' tool via server.tool(), including name, description, input schema reference, and inline handler function.
    server.tool(
      'get_flight_tracks',
      'Returns positional tracks of a specific flight. REQUIRED: flight_id must be provided and non-empty.',
      flightTracksSchema.shape,
      async (params: z.infer<typeof flightTracksSchema>) => {
        try {
          console.log(`Raw params received by handler: ${JSON.stringify(params)}`);
          const result = await fr24Client.getFlightTracks(params);
          const flightId = Array.isArray(result) && result.length > 0 ? result[0].fr24_id : 'unknown';
          return {
            content: [{
              type: 'text' as const,
              text: `Found track points for flight ${flightId}:\n${JSON.stringify(result, null, 2)}`
            }]
          };
        } catch (error) {
          return {
            content: [{
              type: 'text' as const,
              text: `Error: ${error instanceof Error ? error.message : 'Unknown error'}`
            }],
            isError: true
          };
        }
      }
    );
  • Supporting method in FR24Client class that handles the API call to fetch flight tracks data from '/flight-tracks' endpoint.
    async getFlightTracks(params: FlightTracksQueryParams): Promise<FlightTracksResponse[]> {
      return this.makeRequest<FlightTracksResponse[]>('/flight-tracks', 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/BACH-AI-Tools/fr24api-mcp'

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