Skip to main content
Glama

duffel_list_airports

Read-onlyIdempotent

Retrieve a paginated list of airports with optional country filtering using ISO 3166-1 alpha-2 codes to explore available airports and build selection lists.

Instructions

List airports with optional country filter.

This tool retrieves a paginated list of airports. Results can be filtered by country
using ISO 3166-1 alpha-2 country codes (e.g., 'US', 'GB', 'FR').

Use this when:
- Exploring available airports
- Getting airports in a specific country
- Building airport selection lists

Note: For finding a specific airport, use duffel_search_airports instead.

Returns airports in specified format (JSON or Markdown).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paramsYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The main handler function that executes the duffel_list_airports tool logic: processes input parameters, makes API request to /air/airports, filters by country if provided, and formats the response as JSON or Markdown.
    async def list_airports(params: ListAirportsInput) -> str:
        """
        List airports with optional country filter.
        
        This tool retrieves a paginated list of airports. Results can be filtered by country
        using ISO 3166-1 alpha-2 country codes (e.g., 'US', 'GB', 'FR').
        
        Use this when:
        - Exploring available airports
        - Getting airports in a specific country
        - Building airport selection lists
        
        Note: For finding a specific airport, use duffel_search_airports instead.
        
        Returns airports in specified format (JSON or Markdown).
        """
        try:
            query_params = {"limit": params.limit}
            if params.country_code:
                query_params["iata_country_code"] = params.country_code.upper()
            
            response = await make_api_request(
                method="GET",
                endpoint="/air/airports",
                params=query_params
            )
            
            airports = response["data"]
            
            if not airports:
                return "No airports found with the specified criteria."
            
            if params.response_format == ResponseFormat.JSON:
                return truncate_text(format_json_response(airports))
            
            else:  # Markdown format
                title = f"# Airports"
                if params.country_code:
                    title += f" in {params.country_code.upper()}"
                
                lines = [title, "", f"Showing {len(airports)} airports:", ""]
                
                for airport in airports:
                    lines.append(
                        f"- **{airport.get('iata_code', 'N/A')}**: "
                        f"{airport.get('name', 'N/A')} - "
                        f"{airport.get('city_name', 'N/A')}"
                    )
                
                return truncate_text("\n".join(lines))
                
        except Exception as e:
            return f"Error listing airports: {str(e)}"
  • The @mcp.tool decorator that registers the list_airports function as the 'duffel_list_airports' tool with appropriate annotations.
    @mcp.tool(
        name="duffel_list_airports",
        annotations={
            "title": "List Airports",
            "readOnlyHint": True,
            "destructiveHint": False,
            "idempotentHint": True,
            "openWorldHint": True
        }
    )
  • Pydantic BaseModel defining the input parameters for the duffel_list_airports tool, including optional country_code filter, limit, and response_format.
    class ListAirportsInput(BaseModel):
        """Input for listing airports."""
        model_config = ConfigDict(str_strip_whitespace=True, validate_assignment=True, extra='forbid')
    
        country_code: str | None = Field(
            default=None,
            description="Filter by ISO 3166-1 alpha-2 country code (e.g., 'US', 'GB', 'FR')",
            min_length=2,
            max_length=2
        )
        limit: int = Field(
            default=DEFAULT_PAGE_LIMIT,
            description="Number of results per page (1-200)",
            ge=1,
            le=MAX_PAGE_LIMIT
        )
        response_format: ResponseFormat = Field(
            default=ResponseFormat.MARKDOWN,
            description="Output format: 'json' for raw data or 'markdown' for readable summary"
        )
Behavior4/5

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

Annotations already cover read-only, open-world, idempotent, and non-destructive properties. The description adds valuable behavioral context about pagination, country filtering format (ISO 3166-1 alpha-2 codes), and return format options (JSON or Markdown), enhancing understanding beyond annotations.

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 perfectly structured with a clear opening statement, bulleted usage guidelines, explicit alternative tool mention, and return format note. Every sentence adds value with zero wasted words, making it highly efficient and front-loaded.

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

Completeness5/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, rich annotations covering safety properties, and the presence of an output schema (which handles return value documentation), the description provides complete contextual coverage including purpose, usage scenarios, parameter semantics, behavioral details, and sibling differentiation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage for the single parameter, the description fully compensates by explaining the country filter parameter's purpose, format (ISO 3166-1 alpha-2 codes), and providing examples ('US', 'GB', 'FR'), adding substantial meaning beyond the bare schema.

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?

The description clearly states the verb 'retrieves' and resource 'paginated list of airports' with specific filtering capability. It explicitly distinguishes from sibling tool duffel_search_airports, making the purpose distinct and well-defined.

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

Usage Guidelines5/5

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

The description provides explicit 'Use this when' scenarios (exploring airports, country-specific lists, building selection lists) and explicitly names when NOT to use it ('For finding a specific airport, use duffel_search_airports instead'), offering complete guidance on tool selection.

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/FortripEngineering/duffel-mcp'

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