Skip to main content
Glama
Cyreslab-AI

FlightRadar MCP Server

search_flights

Search for flights by airline, departure/arrival airports, or flight status using real-time flight tracking data.

Instructions

Search for flights by various criteria

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
airline_iataNoIATA airline code (e.g., 'BA' for British Airways)
airline_icaoNoICAO airline code (e.g., 'BAW' for British Airways)
dep_iataNoIATA code of departure airport (e.g., 'LHR')
arr_iataNoIATA code of arrival airport (e.g., 'JFK')
flight_statusNoFlight status (e.g., 'scheduled', 'active', 'landed', 'cancelled')
limitNoMaximum number of results to return (default: 10, max: 100)

Implementation Reference

  • The main handler function for the 'search_flights' tool. It processes input arguments to build API query parameters, calls the AviationStack '/flights' endpoint, handles empty results, formats the response data into a structured list of flights with key details, and returns it as JSON text content.
    private async handleSearchFlights(args: any) {
      const params: Record<string, any> = {};
    
      // Add all provided search parameters
      if (args.airline_iata) params.airline_iata = args.airline_iata;
      if (args.airline_icao) params.airline_icao = args.airline_icao;
      if (args.dep_iata) params.dep_iata = args.dep_iata;
      if (args.arr_iata) params.arr_iata = args.arr_iata;
      if (args.flight_status) params.flight_status = args.flight_status;
    
      // Set limit with default and maximum values
      params.limit = Math.min(args.limit || 10, 100);
    
      const response = await this.axiosInstance.get("/flights", { params });
    
      if (!response.data.data || response.data.data.length === 0) {
        return {
          content: [
            {
              type: "text",
              text: "No flights found matching the search criteria.",
            },
          ],
        };
      }
    
      // Format the flight list for better readability
      const flights = response.data.data.map((flight: any) => ({
        flight_number: flight.flight.number,
        flight_iata: flight.flight.iata,
        airline: flight.airline.name,
        departure: {
          airport: flight.departure.airport,
          iata: flight.departure.iata,
          scheduled: flight.departure.scheduled,
        },
        arrival: {
          airport: flight.arrival.airport,
          iata: flight.arrival.iata,
          scheduled: flight.arrival.scheduled,
        },
        status: flight.flight_status,
      }));
    
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify({
              total_results: response.data.pagination.total,
              flights: flights,
            }, null, 2),
          },
        ],
      };
    }
  • Tool registration entry in the ListTools response, defining the name, description, and detailed input schema for search parameters including airline codes, airport codes, flight status enum, and result limit.
    {
      name: "search_flights",
      description: "Search for flights by various criteria",
      inputSchema: {
        type: "object",
        properties: {
          airline_iata: {
            type: "string",
            description: "IATA airline code (e.g., 'BA' for British Airways)",
          },
          airline_icao: {
            type: "string",
            description: "ICAO airline code (e.g., 'BAW' for British Airways)",
          },
          dep_iata: {
            type: "string",
            description: "IATA code of departure airport (e.g., 'LHR')",
          },
          arr_iata: {
            type: "string",
            description: "IATA code of arrival airport (e.g., 'JFK')",
          },
          flight_status: {
            type: "string",
            description: "Flight status (e.g., 'scheduled', 'active', 'landed', 'cancelled')",
            enum: ["scheduled", "active", "landed", "cancelled", "incident", "diverted"],
          },
          limit: {
            type: "number",
            description: "Maximum number of results to return (default: 10, max: 100)",
            minimum: 1,
            maximum: 100,
          },
        },
      },
    },
  • src/index.ts:179-180 (registration)
    Tool dispatch in the CallToolRequestSchema handler switch statement, routing 'search_flights' calls to the handleSearchFlights method.
    case "search_flights":
      return await this.handleSearchFlights(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 only states the action ('search') without any details about permissions, rate limits, pagination, or what the search returns (e.g., flight details, statuses). For a search tool with no annotations, this is insufficient to inform the agent about 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 with no wasted words. It is appropriately sized for a simple search tool and front-loads the core action ('search for flights'), making it easy to parse quickly.

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

Completeness2/5

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

Given the complexity (6 parameters, no annotations, no output schema), the description is incomplete. It doesn't explain what the search returns (e.g., flight objects, statuses), how results are ordered, or any limitations (e.g., real-time vs. historical data). Without annotations or output schema, the description should provide more context to compensate, but it fails to do so.

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 schema description coverage is 100%, meaning all parameters are well-documented in the schema itself (e.g., IATA/ICAO codes, flight status with enum, limit with default and max). The description adds no additional parameter semantics beyond 'by various criteria', which is redundant. Baseline is 3 when schema coverage is high, as the schema does the heavy lifting.

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

Purpose3/5

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

The description states the purpose as 'Search for flights by various criteria', which is clear but vague. It specifies the verb 'search' and resource 'flights', but lacks specificity about what kind of search or how it differs from sibling tools like 'get_flight_data' or 'get_flight_status'. It doesn't provide enough detail to distinguish it from alternatives.

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 the sibling tools 'get_flight_data' or 'get_flight_status'. It mentions 'by various criteria', which implies flexibility, but offers no explicit when-to-use or when-not-to-use instructions, leaving the agent to guess based on tool names alone.

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