Skip to main content
Glama
pab1it0

Tripadvisor MCP

search_locations

Find hotels, restaurants, and attractions on Tripadvisor by searching with keywords, categories, addresses, or coordinates.

Instructions

Search for locations (hotels, restaurants, attractions) on Tripadvisor

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
searchQueryYes
languageNoen
categoryNo
phoneNo
addressNo
latLongNo

Implementation Reference

  • The main handler function implementing the logic for the 'search_locations' tool by preparing parameters and calling the Tripadvisor API endpoint.
    async def search_locations(
        searchQuery: str,
        language: str = "en",
        category: Optional[str] = None,
        phone: Optional[str] = None,
        address: Optional[str] = None,
        latLong: Optional[str] = None,
    ) -> Dict[str, Any]:
        """
        Search for locations on Tripadvisor.
        
        Parameters:
        - searchQuery: The text to search for
        - language: Language code (default: 'en')
        - category: Optional category filter ('hotels', 'attractions', 'restaurants', 'geos')
        - phone: Optional phone number to search for
        - address: Optional address to search for
        - latLong: Optional latitude,longitude coordinates (e.g., '42.3455,-71.0983')
        """
        params = {
            "searchQuery": searchQuery,
            "language": language,
        }
        
        if category:
            params["category"] = category
        if phone:
            params["phone"] = phone
        if address:
            params["address"] = address
        if latLong:
            params["latLong"] = latLong
        
        return await make_api_request("location/search", params)
  • Registers the 'search_locations' tool with the FastMCP server using the decorator.
    @mcp.tool(description="Search for locations (hotels, restaurants, attractions) on Tripadvisor")
  • Supporting helper function used by the tool to perform authenticated HTTP requests to the Tripadvisor Content API.
    async def make_api_request(endpoint: str, params: Dict[str, Any] = None) -> Dict[str, Any]:
        """Make a request to the Tripadvisor Content API"""
        if not config.api_key:
            raise ValueError("Tripadvisor API key is missing. Please set TRIPADVISOR_API_KEY environment variable.")
        
        url = f"{config.base_url}/{endpoint}"
        headers = {
            "accept": "application/json"
        }
    
        if params is None:
            params = {}
        params["key"] = config.api_key
        
        async with httpx.AsyncClient() as client:
            response = await client.get(url, headers=headers, params=params)
            response.raise_for_status()
            return response.json()
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action ('search') but doesn't describe what the search returns (e.g., list of results, pagination), performance characteristics, rate limits, authentication needs, or error conditions. This leaves significant gaps for an agent to understand the tool's behavior.

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 a single, efficient sentence that front-loads the core purpose without unnecessary words. Every part of the sentence contributes directly to understanding the tool's function.

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

Completeness2/5

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

Given the complexity (6 parameters, no schema descriptions, no output schema, no annotations), the description is inadequate. It doesn't address parameter usage, return values, error handling, or behavioral traits, leaving the agent with insufficient information to use the tool effectively beyond its basic purpose.

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

Parameters2/5

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

The input schema has 6 parameters with 0% description coverage, and the tool description provides no information about any parameters. It doesn't explain what 'searchQuery' should contain, how 'category' is used, the format of 'latLong', or the purpose of optional fields like 'phone' and 'address'. This fails to compensate for the schema's lack of documentation.

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

Purpose4/5

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

The description clearly states the verb ('search for') and resource ('locations'), and specifies the domain ('on Tripadvisor') with examples of location types ('hotels, restaurants, attractions'). It doesn't explicitly differentiate from sibling tools like 'search_nearby_locations', but the purpose is unambiguous.

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

Usage Guidelines2/5

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

No guidance is provided on when to use this tool versus alternatives like 'search_nearby_locations' or 'get_location_details'. The description implies a general search function but lacks context about prerequisites, limitations, or optimal use cases.

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/pab1it0/tripadvisor-mcp'

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