Skip to main content
Glama

duffel_get_offer

Read-onlyIdempotent

Retrieve current flight pricing and detailed offer information including schedules, baggage allowances, and booking requirements before confirming travel arrangements.

Instructions

Retrieve detailed information and current pricing for a specific flight offer.

This tool fetches the latest version of an offer, including:
- Up-to-date pricing and availability
- Complete flight schedule and routing
- Passenger requirements and restrictions
- Baggage allowance and cabin details
- Cancellation and change policies

Use this when:
- User selects a flight from search results
- Before booking to confirm current price
- To check if an offer is still available
- To get passenger IDs needed for booking

Important: Always retrieve the offer immediately before booking to ensure pricing
is current, as offers expire after 15-30 minutes.

Returns offer details in specified format (JSON or Markdown).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paramsYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The handler function that implements the core logic of the duffel_get_offer tool, fetching offer details from Duffel API, validating expiration, and formatting output.
    async def get_offer(params: GetOfferInput) -> str:
        """
        Retrieve detailed information and current pricing for a specific flight offer.
        
        This tool fetches the latest version of an offer, including:
        - Up-to-date pricing and availability
        - Complete flight schedule and routing
        - Passenger requirements and restrictions
        - Baggage allowance and cabin details
        - Cancellation and change policies
        
        Use this when:
        - User selects a flight from search results
        - Before booking to confirm current price
        - To check if an offer is still available
        - To get passenger IDs needed for booking
        
        Important: Always retrieve the offer immediately before booking to ensure pricing
        is current, as offers expire after 15-30 minutes.
        
        Returns offer details in specified format (JSON or Markdown).
        """
        try:
            response = await make_api_request(
                method="GET",
                endpoint=f"/air/offers/{params.offer_id}"
            )
            
            offer = response["data"]
            
            expires_at = datetime.fromisoformat(offer["expires_at"].replace("Z", "+00:00"))
            if expires_at < datetime.now().astimezone():
                return (
                    f"⚠️ This offer has expired at {offer['expires_at']}.\n\n"
                    "Offers typically expire 15-30 minutes after creation. "
                    "Please perform a new flight search to get current offers."
                )
            
            if params.response_format == ResponseFormat.JSON:
                return truncate_text(format_json_response(offer))
            
            else:  # Markdown format
                result = format_markdown_flight_offer(offer)
                
                passengers = offer.get("passengers", [])
                if passengers:
                    result += "\n### Passengers\n"
                    for i, pax in enumerate(passengers, 1):
                        result += f"{i}. **ID**: `{pax['id']}` - Type: {pax.get('type', 'N/A')}\n"
                
                conditions = offer.get("conditions", {})
                if conditions:
                    result += "\n### Booking Conditions\n"
                    if conditions.get("change_before_departure"):
                        result += f"- Change allowed: {conditions['change_before_departure'].get('allowed', False)}\n"
                    if conditions.get("refund_before_departure"):
                        result += f"- Refund allowed: {conditions['refund_before_departure'].get('allowed', False)}\n"
                
                return truncate_text(result)
                
        except Exception as e:
            return f"Error retrieving offer: {str(e)}\n\nTroubleshooting:\n- Verify the offer ID is correct (starts with 'off_')\n- Check if the offer has expired\n- Offer might have been booked by someone else"
  • Pydantic input schema defining parameters for duffel_get_offer: offer_id (required, validated pattern) and response_format.
    class GetOfferInput(BaseModel):
        """Input for retrieving a specific flight offer."""
        model_config = ConfigDict(str_strip_whitespace=True, validate_assignment=True, extra='forbid')
    
        offer_id: str = Field(
            ...,
            description="Duffel offer ID (e.g., 'off_00009htYpSCXrwaB9DnUm0')",
            pattern="^off_[a-zA-Z0-9]+$"
        )
        response_format: ResponseFormat = Field(
            default=ResponseFormat.MARKDOWN,
            description="Output format: 'json' for raw data or 'markdown' for readable summary"
        )
  • MCP decorator registering the tool with name 'duffel_get_offer' and operational annotations.
    @mcp.tool(
        name="duffel_get_offer",
        annotations={
            "title": "Get Flight Offer Details",
            "readOnlyHint": True,
            "destructiveHint": False,
            "idempotentHint": True,
            "openWorldHint": True
        }
    )
Behavior4/5

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

Annotations already indicate read-only, non-destructive, idempotent, and open-world behavior. The description adds valuable context beyond annotations: it specifies that offers 'expire after 15-30 minutes,' which is crucial for timing usage. However, it doesn't mention rate limits or authentication needs, leaving some behavioral aspects uncovered.

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 well-structured and front-loaded with the core purpose. Each bullet point and usage guideline sentence adds specific value without redundancy. The 'Important' note is concise and critical, making every part of the text earn its place.

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 complexity (retrieving dynamic flight data), the description is complete. It covers purpose, usage scenarios, critical timing constraints, and key data returned. With annotations covering safety and idempotency, and an output schema handling return format details, no significant gaps remain for agent understanding.

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 input schema has 0% description coverage, and the description provides no details about the single parameter (e.g., what 'params' contains or how to specify the offer). However, with an output schema present, the description doesn't need to explain return values. The baseline is 3 since the schema handles parameter documentation, but the description adds no semantic clarification.

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 'retrieve' and resource 'detailed information and current pricing for a specific flight offer.' It distinguishes from siblings like duffel_search_flights (which searches) and duffel_create_order (which books). The title 'Get Flight Offer Details' reinforces this specificity.

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 explicitly lists four scenarios for when to use this tool (e.g., 'User selects a flight from search results,' 'Before booking to confirm current price'). It also provides a critical exclusion: 'Always retrieve the offer immediately before booking to ensure pricing is current,' which implicitly advises against using stale data from other sources.

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