Skip to main content
Glama
BACH-AI-Tools

Flightradar24 MCP Server

get_historic_flights_positions_light

Retrieve historical aircraft flight positions and movement data by specifying a timestamp and search parameters like flight numbers, aircraft registrations, or geographic areas.

Instructions

Returns historical aircraft flight movement information including latitude, longitude, speed and altitude. FR24 API provides access to historical flight data, dating back to May 11, 2016, depending on the user's subscription plan. IMPORTANT: Timestamp is required, and at least one additional search parameter (other than limit) must be provided and non-empty.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
boundsNoCoordinates defining an area. Order: north, south, west, east (comma-separated float values).
flightsNoFlight numbers (comma-separated values, max 15).
callsignsNoFlight callsigns (comma-separated values, max 15).
registrationsNoAircraft registration numbers (comma-separated values, max 15).
painted_asNoAircraft painted in an airline's livery (ICAO code, comma-separated, max 15).
operating_asNoAircraft operating under an airline's call sign (ICAO code, comma-separated, max 15).
airportsNoAirports (IATA/ICAO/ISO 3166-1 alpha-2) or countries. Use format: [direction:]<code>. Directions: inbound, outbound, both.
routesNoFlights between airports/countries (e.g., SE-US, ESSA-JFK). Max 15.
aircraftNoAircraft ICAO type codes (comma-separated, max 15).
altitude_rangesNoFlight altitude ranges in feet (e.g., 0-3000, 5000-7000).
squawksNoSquawk codes in hex format (comma-separated).
categoriesNoCategories of Flights (comma-separated: P, C, M, J, T, H, B, G, D, V, O, N).
data_sourcesNoSource of information (comma-separated: ADSB, MLAT, ESTIMATED).
airspacesNoFlight information region in lower or upper airspace.
gspeedNoFlight ground speed in knots (single value or range, e.g., 120-140, 80).
limitNoLimit of results. Recommended, unless needed. Max 30000.
timestampYesUnix timestamp for the historical snapshot.

Implementation Reference

  • The MCP tool handler function for 'get_historic_flights_positions_light'. It validates parameters (requiring timestamp and at least one other), cleans optional params, calls FR24Client.getHistoricPositionsLight, formats the response as text with JSON, or returns error.
    async (params: z.infer<typeof historicFlightPositionsSchema>) => {
       try {
        validateHasRequiredParams(params, ['timestamp', 'limit']);
        const { timestamp, ...restParams } = params;
        const cleanedOptionalParams = cleanParams(restParams);
        const result = await fr24Client.getHistoricPositionsLight({ timestamp, ...cleanedOptionalParams });
        return {
          content: [{
            type: 'text' as const,
            text: `Found ${result.length} historic flights (light details) at timestamp ${timestamp}:\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
        };
      }
    }
  • src/server.ts:226-252 (registration)
    Registration of the 'get_historic_flights_positions_light' tool on the MCP server, specifying name, description, input schema, and inline handler function.
    server.tool(
      'get_historic_flights_positions_light',
      'Returns historical aircraft flight movement information including latitude, longitude, speed and altitude. FR24 API provides access to historical flight data, dating back to May 11, 2016, depending on the user\'s subscription plan. IMPORTANT: Timestamp is required, and at least one additional search parameter (other than limit) must be provided and non-empty.',
      historicFlightPositionsSchema.shape,
      async (params: z.infer<typeof historicFlightPositionsSchema>) => {
         try {
          validateHasRequiredParams(params, ['timestamp', 'limit']);
          const { timestamp, ...restParams } = params;
          const cleanedOptionalParams = cleanParams(restParams);
          const result = await fr24Client.getHistoricPositionsLight({ timestamp, ...cleanedOptionalParams });
          return {
            content: [{
              type: 'text' as const,
              text: `Found ${result.length} historic flights (light details) at timestamp ${timestamp}:\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 schemas: baseFlightPositionsSchema (shared parameters like bounds, flights, etc.) extended by historicFlightPositionsSchema to include required timestamp for the tool.
    const baseFlightPositionsSchema = z.object({
      bounds: z.string().min(1).optional().describe('Coordinates defining an area. Order: north, south, west, east (comma-separated float values).'),
      flights: z.string().min(1).optional().describe('Flight numbers (comma-separated values, max 15).'),
      callsigns: z.string().min(1).optional().describe('Flight callsigns (comma-separated values, max 15).'),
      registrations: z.string().min(1).optional().describe('Aircraft registration numbers (comma-separated values, max 15).'),
      painted_as: z.string().min(1).optional().describe("Aircraft painted in an airline's livery (ICAO code, comma-separated, max 15)."),
      operating_as: z.string().min(1).optional().describe("Aircraft operating under an airline's call sign (ICAO code, comma-separated, max 15)."),
      airports: z.string().min(1).optional().describe('Airports (IATA/ICAO/ISO 3166-1 alpha-2) or countries. Use format: [direction:]<code>. Directions: inbound, outbound, both.'),
      routes: z.string().min(1).optional().describe('Flights between airports/countries (e.g., SE-US, ESSA-JFK). Max 15.'),
      aircraft: z.string().min(1).optional().describe('Aircraft ICAO type codes (comma-separated, max 15).'),
      altitude_ranges: z.string().min(1).optional().describe('Flight altitude ranges in feet (e.g., 0-3000, 5000-7000).'),
      squawks: z.string().min(1).optional().describe('Squawk codes in hex format (comma-separated).'),
      categories: z.string().min(1).optional().describe('Categories of Flights (comma-separated: P, C, M, J, T, H, B, G, D, V, O, N).'),
      data_sources: z.string().min(1).optional().describe('Source of information (comma-separated: ADSB, MLAT, ESTIMATED).'),
      airspaces: z.string().min(1).optional().describe('Flight information region in lower or upper airspace.'),
      gspeed: z.string().min(1).optional().describe('Flight ground speed in knots (single value or range, e.g., 120-140, 80).'),
      limit: z.number().optional().describe('Limit of results. Recommended, unless needed. Max 30000.')
    });
    
    const liveFlightPositionsSchema = baseFlightPositionsSchema;
    const liveFlightPositionsCountSchema = baseFlightPositionsSchema;
    
    const historicFlightPositionsSchema = baseFlightPositionsSchema.extend({
      timestamp: z.number().describe('Unix timestamp for the historical snapshot.'),
    });
    
    const historicFlightPositionsCountSchema = baseFlightPositionsSchema.extend({
      timestamp: z.number().describe('Unix timestamp for the historical snapshot.')
    });
  • FR24Client method invoked by the handler to query the FR24 API's historic light flight positions endpoint.
    async getHistoricPositionsLight(params: HistoricFlightPositionsQueryParams): Promise<HistoricFlightPositionLight[]> {
      return this.makeRequest<HistoricFlightPositionLight[]>('/historic/flight-positions/light', params);
    }
  • Utility functions cleanParams (removes empty/null params) and validateHasRequiredParams (ensures at least one non-excluded param is provided), used in the handler.
    function cleanParams<T extends Record<string, any>>(params: T): Partial<T> {
      const cleaned: Partial<T> = {};
      for (const key in params) {
        if (params[key] !== null && params[key] !== undefined && params[key] !== '') {
          cleaned[key] = params[key];
        }
      }
      return cleaned;
    }
    
    // Helper function to validate that at least one meaningful parameter is provided
    function validateHasRequiredParams(params: Record<string, any>, excludeKeys: string[] = ['limit']): void {
      const meaningfulParams = Object.entries(params).filter(([key, value]) => 
        !excludeKeys.includes(key) && 
        value !== null && 
        value !== undefined && 
        value !== ''
      );
      
      if (meaningfulParams.length === 0) {
        throw new Error(`At least one parameter other than ${excludeKeys.join(', ')} must be provided and non-empty. Available parameters: ${Object.keys(params).filter(k => !excludeKeys.includes(k)).join(', ')}`);
      }
    }

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

B3.4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the burden. It discloses the historical data availability (since 2016, plan-dependent) and the mandatory parameter requirements, but omits details about output format, pagination, or potential rate limiting. This is partial but useful disclosure.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is three sentences and front-loaded with the primary purpose. The IMPORTANT note is succinct and essential, earning its place. No redundancy or filler, though it could briefly mention what 'light' means relative to the full variant.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a complex tool with 17 parameters and no output schema or annotations, the description covers the core purpose and critical invocation requirements. Yet it lacks any mention of response shape, error behavior, or how 'light' limits the returned fields. It is adequate but not fully complete for a tool of this complexity.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all 17 parameters. The description adds the important constraint that limit alone is insufficient and at least one other search parameter must be given, which is valuable context beyond the schema. However, it does not explain individual parameter syntax beyond what the schema provides.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool returns historical aircraft flight movement data including latitude, longitude, speed, and altitude. It differentiates from live-flight siblings by specifying 'historical' and from 'full' tools by the 'light' suffix, though it doesn't explicitly contrast with the full version.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It provides an explicit usage constraint (timestamp required, plus at least one non-limit parameter) which is useful for correct invocation. However, it does not say when to prefer this tool over alternatives like get_historic_flights_positions_full or get_live_flights_positions_light.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.