Skip to main content
Glama
pab1it0

Tripadvisor MCP

search_nearby_locations

Find nearby attractions, restaurants, and points of interest using latitude and longitude coordinates to discover local destinations.

Instructions

Search for locations near a specific latitude/longitude

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
latitudeYes
longitudeYes
languageNoen
categoryNo

Implementation Reference

  • The handler function for the 'search_nearby_locations' tool. It formats the latLong parameter and calls the Tripadvisor API's location/search endpoint via make_api_request. The @mcp.tool decorator registers the tool and defines its schema from the function signature and description.
    @mcp.tool(description="Search for locations near a specific latitude/longitude")
    async def search_nearby_locations(
        latitude: float,
        longitude: float,
        language: str = "en",
        category: Optional[str] = None,
    ) -> Dict[str, Any]:
        """
        Search for locations near a specific latitude/longitude.
        
        Parameters:
        - latitude: Latitude coordinate
        - longitude: Longitude coordinate
        - language: Language code (default: 'en')
        - category: Optional category filter ('hotels', 'attractions', 'restaurants')
        """
        params = {
            "latLong": f"{latitude},{longitude}",
            "language": language,
        }
        
        if category:
            params["category"] = category
        
        return await make_api_request("location/search", params)
  • Shared utility function that handles authenticated HTTP requests to the Tripadvisor Content API, adding the API key and handling responses. Used by search_nearby_locations to fetch nearby locations.
    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 full burden for behavioral disclosure. It states the search action but doesn't describe what 'near' means (distance/radius), result format, pagination, rate limits, authentication needs, or error conditions. For a search tool with zero annotation coverage, this leaves significant behavioral gaps.

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 with zero wasted words. It's appropriately sized for a search tool and front-loads the core functionality without unnecessary elaboration.

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 4 parameters with 0% schema coverage, no annotations, no output schema, and multiple sibling tools, the description is incomplete. It covers the basic purpose but lacks parameter details, behavioral context, usage differentiation, and return value information that would help an agent use this tool effectively.

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?

Schema description coverage is 0%, so the description must compensate for undocumented parameters. The description mentions latitude/longitude (covering 2 of 4 parameters) but doesn't explain the 'language' or 'category' parameters, their formats, or valid values. It adds some meaning for required parameters but leaves half the parameters unexplained.

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 tool's purpose as 'Search for locations near a specific latitude/longitude', which includes a specific verb ('Search') and resource ('locations') with geographic context. However, it doesn't distinguish this tool from its sibling 'search_locations', which might have different functionality.

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?

The description provides no guidance on when to use this tool versus alternatives like 'search_locations' or when not to use it. There's no mention of prerequisites, limitations, or comparison with sibling tools, leaving the agent without contextual usage information.

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