Skip to main content
Glama
SoapyRED

FreightUtils MCP Server

airline_lookup

Read-onlyIdempotent

Search 6,352 airlines by name, IATA/ICAO code, AWB prefix, or country to find airline codes and verify cargo capabilities.

Instructions

Search 6,352 airlines by name, IATA/ICAO code, AWB prefix, or country.

Use this tool when you need to:

  • Find an airline's IATA code, ICAO code, or air waybill (AWB) prefix

  • Verify airline cargo capabilities

  • Look up airlines by country

AWB prefixes are 3-digit codes used on air waybills to identify the issuing carrier (e.g., 176 = Emirates).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryNoGeneral search (name, code, prefix, or country — min 2 chars)
iataNoExact IATA code (2 chars, e.g., "EK")
icaoNoExact ICAO code (3 chars, e.g., "UAE")
prefixNoAWB prefix (3 digits, e.g., "176")
countryNoFilter by country name (min 2 chars)

Implementation Reference

  • The handler function for airline_lookup. Calls apiGet('airlines', ...) passing query parameters (q, iata, icao, prefix, country) to the FreightUtils API.
      handler: async (args) =>
        apiGet('airlines', {
          q: args.query, iata: args.iata, icao: args.icao,
          prefix: args.prefix, country: args.country,
        }),
    };
  • Zod schema defining the input parameters for airline_lookup: optional query (min 2 chars), iata (exactly 2 chars), icao (exactly 3 chars), prefix (exactly 3 digits), and country (min 2 chars). Uses .strict() to reject unknown keys.
    schema: z.object({
      query: z.string().min(2, 'Query must be at least 2 characters').optional().describe('General search (name, code, prefix, or country — min 2 chars)'),
      iata: z.string().length(2, 'IATA code must be exactly 2 characters').optional().describe('Exact IATA code (2 chars, e.g., "EK")'),
      icao: z.string().length(3, 'ICAO code must be exactly 3 characters').optional().describe('Exact ICAO code (3 chars, e.g., "UAE")'),
      prefix: z.string().regex(/^\d{3}$/, 'AWB prefix must be exactly 3 digits').optional().describe('AWB prefix (3 digits, e.g., "176")'),
      country: z.string().min(2, 'Country must be at least 2 characters').optional().describe('Filter by country name (min 2 chars)'),
    }).strict(),
  • src/tools.ts:713-733 (registration)
    airlineLookup is listed in the ALL_TOOLS array (line 720), which is iterated over in server.ts (line 19-42) to register each tool with the MCP server via server.tool(...).
    export const ALL_TOOLS: ToolDef[] = [
      cbmCalculator,
      chargeableWeightCalculator,
      ldmCalculator,
      adrLookup,
      adrExemptionCalculator,
      adrLqEqCheck,
      airlineLookup,
      containerLookup,
      hsCodeLookup,
      incotermsLookup,
      palletFittingCalculator,
      unitConverter,
      consignmentCalculator,
      unlocodeLookup,
      ukDutyCalculator,
      shipmentSummary,
      uldLookup,
      vehicleLookup,
      getSubscribeLink,
    ];
  • src/server.ts:19-42 (registration)
    The registration loop that iterates ALL_TOOLS and calls server.tool(...) for each, including airline_lookup, binding its name, description, schema, annotations, and handler.
    for (const tool of ALL_TOOLS) {
      server.tool(
        tool.name,
        tool.description,
        tool.schema.shape,
        tool.annotations,
        async (args: Record<string, unknown>) => {
          try {
            const result = await tool.handler(args);
            return {
              content: [
                { type: 'text' as const, text: JSON.stringify(result, null, 2) },
              ],
            };
          } catch (err: unknown) {
            const message = err instanceof Error ? err.message : String(err);
            return {
              content: [{ type: 'text' as const, text: `Error: ${message}` }],
              isError: true,
            };
          }
        },
      );
    }
  • The apiGet helper function used by the airline_lookup handler to make a GET request to the FreightUtils API.
    export async function apiGet(endpoint: string, params: Record<string, unknown>): Promise<unknown> {
      const url = new URL(`${BASE_URL}/${endpoint}`);
      for (const [k, v] of Object.entries(params)) {
        if (v === undefined || v === null || v === '') continue;
        url.searchParams.set(k, String(v));
      }
    
      const res = await fetch(url.toString(), {
        headers: { 'Accept': 'application/json' },
      });
    
      if (!res.ok) {
        const body = await res.text();
        throw new Error(`FreightUtils API error ${res.status}: ${body}`);
      }
    
      return res.json();
    }
    
    export async function apiPost(endpoint: string, body: unknown): Promise<unknown> {
      const res = await fetch(`${BASE_URL}/${endpoint}`, {
        method: 'POST',
        headers: { 'Content-Type': 'application/json', 'Accept': 'application/json' },
        body: JSON.stringify(body),
      });
    
      if (!res.ok) {
        const text = await res.text();
        throw new Error(`FreightUtils API error ${res.status}: ${text}`);
      }
    
      return res.json();
    }
Behavior4/5

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

Annotations declare readOnlyHint=true, destructiveHint=false, idempotentHint=true. Description adds context: searches a specific database of 6,352 airlines, explains AWB prefixes. No contradiction.

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?

Description is concise: one introductory sentence, bullet points for use cases, and a brief note on AWB prefixes. No redundant information.

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

Completeness4/5

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

For a lookup tool with 5 optional parameters, the description covers the data source, searchable fields, and use cases. Lacks return value details but no output schema exists; overall adequate.

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?

Schema description coverage is 100%, so each parameter is already well-documented. Description provides overarching context but adds minimal new per-parameter meaning beyond the schema. Baseline 3 is appropriate.

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

Purpose5/5

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

Description clearly states it searches 6,352 airlines by name, IATA/ICAO code, AWB prefix, or country. It distinguishes from sibling tools (e.g., container_lookup, uld_lookup) by focusing specifically on airlines. Includes concrete example (176 = Emirates).

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

Usage Guidelines4/5

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

Explicitly lists use cases: find codes, verify cargo capabilities, look up by country. Does not mention when not to use, but siblings are clearly different domains, so guidance is sufficient.

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/SoapyRED/freightutils-mcp'

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