Skip to main content
Glama

amadeus.airports.nearest

Find the nearest airports to any geographic location by providing latitude and longitude coordinates. Search within a specified radius to identify nearby airport options for travel planning.

Instructions

Find nearest airports by geographic coordinates (Amadeus)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
latitudeYesLatitude in decimal degrees (-90 to 90)
longitudeYesLongitude in decimal degrees (-180 to 180)
radiusNoSearch radius in km (1-500)

Implementation Reference

  • The core handler that builds the API request for 'amadeus.airport_nearest'. Constructs a GET request to Amadeus API endpoint /v1/reference-data/locations/airports with latitude, longitude, and optional radius parameters.
    private buildAirportNearestRequest(params: Record<string, unknown>): {
      url: string;
      method: string;
      headers: Record<string, string>;
    } {
      const qs = new URLSearchParams({
        latitude: String(params.latitude),
        longitude: String(params.longitude),
      });
    
      if (params.radius) qs.set('radius', String(params.radius));
    
      return {
        url: `${this.baseUrl}/v1/reference-data/locations/airports?${qs.toString()}`,
        method: 'GET',
        headers: { 'Authorization': `Bearer ${this.currentToken}` },
      };
    }
  • Response parser for 'amadeus.airport_nearest' tool. Validates and casts the raw API response to AmadeusNearestAirportResponse type, throwing an error if data is missing.
    case 'amadeus.airport_nearest': {
      const data = body as AmadeusNearestAirportResponse;
      if (!data.data) {
        throw new Error('Missing data in Amadeus airport nearest response');
      }
      return data;
    }
  • Zod schema for 'amadeus.airport_nearest' input validation. Defines required latitude (-90 to 90), longitude (-180 to 180), and optional radius (1-500 km, default 500) parameters.
    const amadeusAirportNearest = z
      .object({
        latitude: z.number().min(-90).max(90).describe('Latitude in decimal degrees (-90 to 90)'),
        longitude: z.number().min(-180).max(180).describe('Longitude in decimal degrees (-180 to 180)'),
        radius: z.number().int().min(1).max(500).optional().default(500).describe('Search radius in km (1-500)'),
      })
      .strip();
  • Tool registration mapping internal toolId 'amadeus.airport_nearest' to MCP name 'amadeus.airports.nearest' with title and description for MCP clients.
    {
      toolId: 'amadeus.airport_nearest',
      mcpName: 'amadeus.airports.nearest',
      title: 'Find Nearest Airports',
      description: 'Find nearest airports by geographic coordinates (Amadeus)',
      annotations: READ_ONLY,
    },
  • TypeScript type definitions for the nearest airport response. AmadeusNearestAirport extends AmadeusLocation with distance and relevance fields.
    export interface AmadeusNearestAirport extends AmadeusLocation {
      distance: { value: number; unit: string };
      relevance: number;
    }
    
    export type AmadeusNearestAirportResponse = AmadeusResponse<AmadeusNearestAirport>;

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/whiteknightonhorse/APIbase'

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