Skip to main content
Glama

search_hotels

Find available hotels in a city for specific dates and guest count, with optional price filters.

Instructions

Search for available hotels in a destination.

Args: destination: City name (e.g. "Tokyo", "Paris", "London") check_in: Check-in date in YYYY-MM-DD format check_out: Check-out date in YYYY-MM-DD format guests: Number of guests (default: 1) max_price: Maximum price per night in USD (optional)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
destinationYes
check_inYes
check_outYes
guestsNo
max_priceNo

Implementation Reference

  • The MCP tool handler for 'search_hotels' — decorated with @mcp.tool(), accepts destination, check_in, check_out, guests, max_price and delegates to hotels.search().
    def search_hotels(
        destination: str,
        check_in: str,
        check_out: str,
        guests: int = 1,
        max_price: Optional[float] = None,
    ) -> list:
        """
        Search for available hotels in a destination.
    
        Args:
            destination: City name (e.g. "Tokyo", "Paris", "London")
            check_in: Check-in date in YYYY-MM-DD format
            check_out: Check-out date in YYYY-MM-DD format
            guests: Number of guests (default: 1)
            max_price: Maximum price per night in USD (optional)
        """
        return hotels.search(destination, check_in, check_out, guests, max_price)
  • Type annotations and docstring define the schema: destination (str), check_in (str), check_out (str), guests (int=1), max_price (Optional[float]).
    def search_hotels(
        destination: str,
        check_in: str,
        check_out: str,
        guests: int = 1,
        max_price: Optional[float] = None,
    ) -> list:
        """
        Search for available hotels in a destination.
    
        Args:
            destination: City name (e.g. "Tokyo", "Paris", "London")
            check_in: Check-in date in YYYY-MM-DD format
            check_out: Check-out date in YYYY-MM-DD format
            guests: Number of guests (default: 1)
            max_price: Maximum price per night in USD (optional)
        """
        return hotels.search(destination, check_in, check_out, guests, max_price)
  • Tool registered via @mcp.tool() decorator on the search_hotels function.
    @mcp.tool()
  • The hotels.search() helper function — thin wrapper that calls query_hotels() from mock data and returns results or a 'not found' message.
    def search(
        destination: str,
        check_in: str,
        check_out: str,
        guests: int,
        max_price: float | None,
    ) -> list[dict]:
        results = query_hotels(destination, check_in, check_out, guests, max_price)
        if not results:
            return [{"message": f"No hotels found in '{destination}'" + (f" under ${max_price}/night." if max_price else ".")}]
        return results
  • The query_hotels() function — core mock data query logic: normalizes city name, looks up hotels, filters by max_price, computes nights/total_price, and returns sorted results.
    def query_hotels(
        destination: str,
        check_in: str,
        check_out: str,
        guests: int,
        max_price: float | None,
    ) -> list[dict]:
        from datetime import datetime
    
        city = _normalize(destination)
        hotels = _HOTELS.get(city, [])
    
        if not hotels:
            for key in _HOTELS:
                if key in city or city in key:
                    hotels = _HOTELS[key]
                    break
    
        try:
            nights = (datetime.strptime(check_out, "%Y-%m-%d") - datetime.strptime(check_in, "%Y-%m-%d")).days
            if nights <= 0:
                nights = 1
        except ValueError:
            nights = 1
    
        results = []
        for hotel in hotels:
            if max_price and hotel["price_per_night"] > max_price:
                continue
            results.append({
                **hotel,
                "check_in": check_in,
                "check_out": check_out,
                "nights": nights,
                "guests": guests,
                "total_price": hotel["price_per_night"] * nights,
                "currency": "USD",
            })
    
        return sorted(results, key=lambda x: x["price_per_night"])
Behavior3/5

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

No annotations are provided, so the description must disclose behavior. It describes parameters and that it searches for hotels, but does not mention output format, error handling, or whether it is read-only. Adequate but lacks depth.

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 concise, with a clear one-sentence purpose followed by structured parameter details. No wasted words, each line adds value.

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

Completeness3/5

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

The description covers input parameters well but lacks any information about the output (e.g., what information is returned per hotel, whether results are a list). Since there is no output schema, this omission is a gap for a search tool.

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?

Schema coverage is 0%, so the description fully explains parameters: destination (city name with examples), dates (YYYY-MM-DD), guests (default 1), max_price (optional, max per night USD). Adds significant meaning beyond the schema titles and types.

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 'Search for available hotels in a destination.' The verb 'search' and resource 'hotels' are specific, and it distinguishes from siblings like search_flights (flights) and search_poi (points of interest).

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?

Usage is implied by the tool name and description, but there is no explicit guidance on when to use this vs. alternatives like search_flights or plan_trip. No when-not or alternatives mentioned.

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/ismailrz/travel-mcp-server'

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