Skip to main content
Glama
BACH-AI-Tools

Flightradar24 MCP Server

get_live_flights_count

Count real-time aircraft flights by specifying criteria like location, flight numbers, aircraft types, or airports to track aviation activity.

Instructions

Returns the count of real-time aircraft flights matching the specified criteria. IMPORTANT: At least one search parameter (other than limit) must be provided and non-empty. Choose from: bounds, flights, callsigns, registrations, painted_as, operating_as, airports, routes, aircraft, altitude_ranges, squawks, categories, data_sources, airspaces, gspeed.

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.

Implementation Reference

  • src/server.ts:171-196 (registration)
    Registers the 'get_live_flights_count' MCP tool with description, input schema, and handler function that validates, cleans params, fetches count from FR24Client, and returns formatted response.
    server.tool(
      'get_live_flights_count',
      'Returns the count of real-time aircraft flights matching the specified criteria. IMPORTANT: At least one search parameter (other than limit) must be provided and non-empty. Choose from: bounds, flights, callsigns, registrations, painted_as, operating_as, airports, routes, aircraft, altitude_ranges, squawks, categories, data_sources, airspaces, gspeed.',
      liveFlightPositionsCountSchema.shape,
      async (params: z.infer<typeof liveFlightPositionsCountSchema>) => {
        try {
          validateHasRequiredParams(params, ['limit']);
          const cleaned = cleanParams(params);
          const result = await fr24Client.getLivePositionsCount(cleaned);
          return {
            content: [{
              type: 'text' as const,
              text: `Live flight 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 (baseFlightPositionsSchema) defining optional input parameters for live flight queries, aliased to liveFlightPositionsCountSchema used by 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;
  • Inline handler function for the tool: validates parameters, cleans empty values, calls FR24Client.getLivePositionsCount, returns count or error in MCP format.
    async (params: z.infer<typeof liveFlightPositionsCountSchema>) => {
      try {
        validateHasRequiredParams(params, ['limit']);
        const cleaned = cleanParams(params);
        const result = await fr24Client.getLivePositionsCount(cleaned);
        return {
          content: [{
            type: 'text' as const,
            text: `Live flight 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 API request to retrieve live flight positions count.
    async getLivePositionsCount(params: LiveFlightPositionsCountQueryParams): Promise<RecordCountResponse> {
      return this.makeRequest<RecordCountResponse>('/live/flight-positions/count', params);
    }
  • Helper function used in handler to ensure at least one non-limit 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(', ')}`);
      }
    }
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively communicates the constraint that at least one non-limit parameter is required, which is crucial behavioral information not evident from the schema alone. However, it doesn't mention rate limits, authentication requirements, or what happens when no matches are found.

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

Conciseness5/5

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

The description is perfectly structured: a clear purpose statement followed by an important constraint, then a comprehensive parameter list. Every sentence earns its place, with no redundant information. The front-loaded constraint is particularly effective for agent decision-making.

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

Completeness4/5

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

For a query tool with 16 parameters and no output schema, the description provides good context about the mandatory parameter requirement and available search dimensions. However, without annotations or output schema, it could benefit from mentioning what the count output looks like (e.g., integer, format) or any performance considerations for this real-time data.

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 16 parameters thoroughly. The description adds minimal value beyond listing parameter names - it doesn't provide additional context about parameter interactions, precedence, or usage patterns beyond the schema's individual parameter descriptions.

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

Purpose5/5

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

The description clearly states the tool's purpose with a specific verb ('Returns') and resource ('count of real-time aircraft flights'), and distinguishes it from siblings by specifying it's about 'count' rather than detailed positions or summaries. It explicitly mentions 'real-time' which differentiates it from historic flight tools.

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

Usage Guidelines5/5

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

The description provides explicit usage guidance: 'IMPORTANT: At least one search parameter (other than limit) must be provided and non-empty.' It also lists all available search parameters, giving clear context for when to use this tool versus alternatives that might focus on different data types or detail levels.

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

Install Server

Other Tools

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