Skip to main content
Glama
Cyreslab-AI

FlightRadar MCP Server

get_flight_data

Retrieve real-time flight status and tracking information by providing a flight number, enabling users to monitor specific flights and access current data.

Instructions

Get real-time data for a specific flight by flight number

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
flight_iataNoIATA flight code (e.g., 'BA123')
flight_icaoNoICAO flight code (e.g., 'BAW123')

Implementation Reference

  • The handler function that executes the get_flight_data tool logic. It validates input, calls the AviationStack API, formats the response, and returns structured flight data.
    /**
     * Handle the get_flight_data tool
     */
    private async handleGetFlightData(args: any) {
      const params: Record<string, any> = {};
    
      if (args.flight_iata) {
        params.flight_iata = args.flight_iata;
      } else if (args.flight_icao) {
        params.flight_icao = args.flight_icao;
      } else {
        throw new McpError(
          ErrorCode.InvalidParams,
          "Either flight_iata or flight_icao must be provided"
        );
      }
    
      const response = await this.axiosInstance.get("/flights", { params });
    
      if (!response.data.data || response.data.data.length === 0) {
        return {
          content: [
            {
              type: "text",
              text: "No flight data found for the specified flight number.",
            },
          ],
        };
      }
    
      // Format the flight data for better readability
      const flightData = response.data.data[0];
      const formattedData = {
        flight: {
          number: flightData.flight.number,
          iata: flightData.flight.iata,
          icao: flightData.flight.icao,
        },
        airline: {
          name: flightData.airline.name,
          iata: flightData.airline.iata,
          icao: flightData.airline.icao,
        },
        departure: {
          airport: flightData.departure.airport,
          iata: flightData.departure.iata,
          icao: flightData.departure.icao,
          terminal: flightData.departure.terminal,
          gate: flightData.departure.gate,
          scheduled: flightData.departure.scheduled,
          estimated: flightData.departure.estimated,
          actual: flightData.departure.actual,
        },
        arrival: {
          airport: flightData.arrival.airport,
          iata: flightData.arrival.iata,
          icao: flightData.arrival.icao,
          terminal: flightData.arrival.terminal,
          gate: flightData.arrival.gate,
          scheduled: flightData.arrival.scheduled,
          estimated: flightData.arrival.estimated,
          actual: flightData.arrival.actual,
        },
        status: flightData.flight_status,
        aircraft: flightData.aircraft,
        live: flightData.live,
      };
    
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(formattedData, null, 2),
          },
        ],
      };
    }
  • Input schema for the get_flight_data tool, specifying either flight_iata or flight_icao as required parameters.
    inputSchema: {
      type: "object",
      properties: {
        flight_iata: {
          type: "string",
          description: "IATA flight code (e.g., 'BA123')",
        },
        flight_icao: {
          type: "string",
          description: "ICAO flight code (e.g., 'BAW123')",
        },
      },
      oneOf: [
        { required: ["flight_iata"] },
        { required: ["flight_icao"] },
      ],
    },
  • src/index.ts:79-99 (registration)
    Tool registration in the ListTools response, defining name, description, and input schema.
    {
      name: "get_flight_data",
      description: "Get real-time data for a specific flight by flight number",
      inputSchema: {
        type: "object",
        properties: {
          flight_iata: {
            type: "string",
            description: "IATA flight code (e.g., 'BA123')",
          },
          flight_icao: {
            type: "string",
            description: "ICAO flight code (e.g., 'BAW123')",
          },
        },
        oneOf: [
          { required: ["flight_iata"] },
          { required: ["flight_icao"] },
        ],
      },
    },
  • src/index.ts:177-178 (registration)
    Dispatch registration in the CallToolRequestHandler switch statement that routes calls to the handler.
    case "get_flight_data":
      return await this.handleGetFlightData(request.params.arguments);
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool 'Get[s] real-time data,' implying a read operation, but doesn't specify if it requires authentication, has rate limits, returns structured data, or handles errors. For a tool with no annotation coverage, this leaves significant gaps in understanding its operational behavior.

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 a single, efficient sentence that directly states the tool's purpose without unnecessary words. It is front-loaded with the core action and resource, making it easy to parse quickly. Every part of the sentence contributes essential information, earning its place.

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?

Given the tool's moderate complexity (2 parameters, no output schema, no annotations), the description is adequate but incomplete. It covers the basic purpose but lacks details on usage guidelines, behavioral traits, and how it fits with siblings. Without an output schema, it doesn't explain return values, which is a gap, but the concise purpose statement provides a minimal viable foundation.

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?

The description adds minimal meaning beyond the input schema, which has 100% coverage. It implies the tool uses a flight number parameter, but doesn't clarify the relationship between 'flight_iata' and 'flight_icao' or why both are options. Since the schema already documents these parameters well, the baseline score of 3 is appropriate, as the description doesn't significantly enhance parameter understanding.

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's purpose: 'Get real-time data for a specific flight by flight number.' It specifies the verb ('Get'), resource ('real-time data'), and scope ('specific flight by flight number'), making the intent unambiguous. However, it doesn't explicitly differentiate from sibling tools like 'get_flight_status' or 'search_flights', which might offer overlapping functionality.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It mentions retrieving data 'by flight number,' but doesn't clarify if this is for a single flight lookup, how it differs from 'get_flight_status' (which might focus on status updates) or 'search_flights' (which could handle broader queries). No exclusions, prerequisites, or context for tool selection are included.

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/Cyreslab-AI/flightradar-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server