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
| Name | Required | Description | Default |
|---|---|---|---|
| flight_id | Yes | Flightradar24 ID of the flight (hexadecimal). |
Implementation Reference
- src/server.ts:367-388 (handler)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 }; } }
- src/server.ts:89-91 (schema)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 }; } } );
- src/fr24-client.ts:108-110 (helper)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); }