Skip to main content
Glama
BACH-AI-Tools

Flightradar24 MCP Server

get_flight_summary_count

Count flights matching specific criteria within a defined time range using Flightradar24 data. Specify date/time parameters plus additional search filters like flight numbers, airports, or aircraft types.

Instructions

Returns the number of flights for a given flight summary query. IMPORTANT: flight_datetime_from and flight_datetime_to are required, and at least one additional search parameter should be provided.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
flight_datetime_fromYesStart datetime (YYYY-MM-DDTHH:MM:SSZ). Requires flight_datetime_to. Cannot be used with flight_ids.
flight_datetime_toYesEnd datetime (YYYY-MM-DDTHH:MM:SSZ). Requires flight_datetime_from. Cannot be used with flight_ids.
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>.
routesNoFlights between airports/countries (e.g., SE-US, ESSA-JFK). Max 15.
aircraftNoAircraft ICAO type codes (comma-separated, max 15).

Implementation Reference

  • The main handler function for the 'get_flight_summary_count' tool. Validates input parameters, cleans them, calls the FR24 client method, logs the result, and returns the flight summary count in a formatted text response or an error.
    async (params: z.infer<typeof flightSummaryCountToolParamsSchema>) => {
      try {
        validateHasRequiredParams(params, ['flight_datetime_from', 'flight_datetime_to']);
        const cleaned = cleanParams(params);
        const result = await fr24Client.getFlightSummaryCount(cleaned);
        console.log(`Flight summary count result: ${JSON.stringify(result, null, 2)}`);
        return {
          content: [{
            type: 'text' as const,
            text: `Flight summary count: ${result.record_count}`
          }]
        };
      } catch (error) {
        return {
          content: [{ 
            type: 'text' as const,
            text: `Error: ${error instanceof Error ? error.message : 'Unknown error'}`
          }],
          isError: true
        };
      }
    }
  • Zod schema defining the input parameters for the get_flight_summary_count tool, including required date range and optional filters.
    const flightSummaryCountToolParamsSchema = z.object({
      flight_datetime_from: z.string().min(1).describe('Start datetime (YYYY-MM-DDTHH:MM:SSZ). Requires flight_datetime_to. Cannot be used with flight_ids.'),
      flight_datetime_to: z.string().min(1).describe('End datetime (YYYY-MM-DDTHH:MM:SSZ). Requires flight_datetime_from. Cannot be used with flight_ids.'),
      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>.'),
      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).')
    });
  • src/server.ts:336-362 (registration)
    MCP server.tool registration for 'get_flight_summary_count', including name, description, schema reference, and inline handler function.
    server.tool(
      'get_flight_summary_count',
      'Returns the number of flights for a given flight summary query. IMPORTANT: flight_datetime_from and flight_datetime_to are required, and at least one additional search parameter should be provided.',
      flightSummaryCountToolParamsSchema.shape,
      async (params: z.infer<typeof flightSummaryCountToolParamsSchema>) => {
        try {
          validateHasRequiredParams(params, ['flight_datetime_from', 'flight_datetime_to']);
          const cleaned = cleanParams(params);
          const result = await fr24Client.getFlightSummaryCount(cleaned);
          console.log(`Flight summary count result: ${JSON.stringify(result, null, 2)}`);
          return {
            content: [{
              type: 'text' as const,
              text: `Flight summary count: ${result.record_count}`
            }]
          };
        } catch (error) {
          return {
            content: [{ 
              type: 'text' as const,
              text: `Error: ${error instanceof Error ? error.message : 'Unknown error'}`
            }],
            isError: true
          };
        }
      }
    );
  • FR24Client helper method that performs the actual API request to retrieve the flight summary count.
    async getFlightSummaryCount(params: Record<string, any>): Promise<RecordCountResponse> {
      return this.makeRequest<RecordCountResponse>('/flight-summary/count', 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