Skip to main content
Glama
HaroldLeo

Google Flights MCP Server

by HaroldLeo

generate_google_flights_url

Create Google Flights search URLs from natural language queries for flight searches, price comparisons, and itinerary planning with customizable parameters.

Instructions

Generate a Google Flights search URL that opens in the browser.
Creates search URLs using natural language queries.

Args:
    origin: Origin airport code (e.g., "SFO").
    destination: Destination airport code (e.g., "JFK").
    departure_date: Departure date (YYYY-MM-DD format).
    return_date: Return date for round-trip (YYYY-MM-DD format, optional).
    adults: Number of adult passengers (default: 1).
    children: Number of children (default: 0).
    seat_type: Fare class - economy/premium_economy/business/first (default: "economy").

Returns:
    JSON with the Google Flights URL.

Example Args:
    {"origin": "SFO", "destination": "JFK", "departure_date": "2025-07-20"}
    {"origin": "SFO", "destination": "JFK", "departure_date": "2025-07-20", "return_date": "2025-07-27"}

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
originYes
destinationYes
departure_dateYes
return_dateNo
adultsNo
childrenNo
seat_typeNoeconomy

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • Helper function that constructs a Google Flights URL (tfs parameter format) from flight parameters. This is the exact implementation for generating the Google Flights shareable link used in the fallback flight search.
    def create_booking_url(origin: str, destination: str, outbound_date: str, return_date: Optional[str] = None, seat_type: str = "economy", adults: int = 1) -> str:
        """
        Create Google Flights booking URL.
    
        Args:
            origin: Origin airport code
            destination: Destination airport code
            outbound_date: Departure date
            return_date: Return date (optional)
            seat_type: Cabin class
            adults: Number of passengers
    
        Returns:
            Google Flights URL
        """
        base_url = "https://www.google.com/travel/flights"
    
        # Build query params
        params = []
    
        # Add origin and destination
        params.append(f"f=0.{origin}.{destination}.{outbound_date}")
    
        if return_date:
            params.append(f"*{destination}.{origin}.{return_date}")
    
        # Add passengers
        params.append(f"1.{adults}.0.0.0")
    
        # Add class
        class_map = {"economy": "y", "premium_economy": "w", "business": "c", "first": "f"}
        class_code = class_map.get(seat_type.lower(), "y")
        params.append(class_code)
    
        query = ".".join(params)
    
        return f"{base_url}?tfs={query}"
Behavior3/5

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

With no annotations provided, the description carries the full burden. It discloses that the tool generates URLs for browser use and handles natural language queries, which is useful behavioral context. However, it doesn't mention potential limitations like URL length constraints, error handling, or authentication needs, leaving gaps for a mutation-like tool (URL generation).

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with clear sections (purpose, args, returns, examples) and uses bullet-like formatting for parameters. It's appropriately sized, though the example args could be integrated more seamlessly. Every sentence adds value, with 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?

Given the tool's moderate complexity (7 parameters, no annotations, but with output schema), the description is largely complete. It explains parameters thoroughly, states the return format (JSON with URL), and provides examples. The output schema handles return values, so the description doesn't need to detail them further. Minor gaps include lack of error case explanations.

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

Parameters5/5

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

The schema description coverage is 0%, so the description must compensate fully. It provides detailed parameter semantics in the 'Args' section, explaining each parameter's purpose, format (e.g., airport codes, YYYY-MM-DD), defaults, and optionality. This adds significant value beyond the bare schema, making parameters clear and actionable.

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 tool's purpose: 'Generate a Google Flights search URL that opens in the browser' and 'Creates search URLs using natural language queries.' It specifies the verb ('generate'), resource ('Google Flights search URL'), and distinguishes it from sibling tools that perform actual flight searches rather than URL generation.

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

Usage Guidelines3/5

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

The description implies usage context by mentioning 'natural language queries' and the browser opening, but it doesn't explicitly state when to use this tool versus the sibling flight search tools. No alternatives or exclusions are provided, leaving the agent to infer based on tool names.

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/HaroldLeo/google-flights-mcp'

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