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
| Name | Required | Description | Default |
|---|---|---|---|
| flight_datetime_from | Yes | Start datetime (YYYY-MM-DDTHH:MM:SSZ). Requires flight_datetime_to. Cannot be used with flight_ids. | |
| flight_datetime_to | Yes | End datetime (YYYY-MM-DDTHH:MM:SSZ). Requires flight_datetime_from. Cannot be used with flight_ids. | |
| flights | No | Flight numbers (comma-separated values, max 15). | |
| callsigns | No | Flight callsigns (comma-separated values, max 15). | |
| registrations | No | Aircraft registration numbers (comma-separated values, max 15). | |
| painted_as | No | Aircraft painted in an airline's livery (ICAO code, comma-separated, max 15). | |
| operating_as | No | Aircraft operating under an airline's call sign (ICAO code, comma-separated, max 15). | |
| airports | No | Airports (IATA/ICAO/ISO 3166-1 alpha-2) or countries. Use format: [direction:]<code>. | |
| routes | No | Flights between airports/countries (e.g., SE-US, ESSA-JFK). Max 15. | |
| aircraft | No | Aircraft ICAO type codes (comma-separated, max 15). |
Implementation Reference
- src/server.ts:340-361 (handler)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 }; } }
- src/server.ts:76-87 (schema)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 }; } } );
- src/fr24-client.ts:102-104 (helper)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); }