Skip to main content
Glama
hhw67865

TripAdvisor Vacation Planner MCP Server

by hhw67865

get_nearby_locations

Find hotels, restaurants, and attractions near specific coordinates to plan trips using TripAdvisor data.

Instructions

Find locations near a specific latitude and longitude

Args:
    latitude: Latitude coordinate
    longitude: Longitude coordinate
    category: Optional category filter (e.g., "hotels", "restaurants", "attractions")

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
latitudeYes
longitudeYes
categoryNo

Implementation Reference

  • The handler function for the 'get_nearby_locations' tool. It is decorated with @mcp.tool() for registration, includes input schema in the function signature and docstring, makes an API call to TripAdvisor's nearby_search endpoint, and returns the results as JSON.
    @mcp.tool()
    async def get_nearby_locations(latitude: float, longitude: float, category: Optional[str] = None) -> str:
        """
        Find locations near a specific latitude and longitude
        
        Args:
            latitude: Latitude coordinate
            longitude: Longitude coordinate
            category: Optional category filter (e.g., "hotels", "restaurants", "attractions")
        """
        params = {"latLong": f"{latitude},{longitude}"}
        if category:
            params["category"] = category
        
        result = await tripadvisor_api_request("location/nearby_search", params)
        return json.dumps(result, indent=2)
  • Helper function used by the get_nearby_locations tool to perform authenticated HTTP requests to the TripAdvisor API.
    async def tripadvisor_api_request(endpoint: str, params: Dict[str, Any] = None) -> Dict[str, Any]:
        """Make a request to the TripAdvisor API"""
        if not TRIPADVISOR_API_KEY:
            return {"error": "TripAdvisor API key not configured. Set TRIPADVISOR_API_KEY environment variable."}
        
        headers = {"accept": "application/json", "key": TRIPADVISOR_API_KEY}
    
        if params is None:
            params = {}
    
        params["key"] = TRIPADVISOR_API_KEY
    
        url = f"{API_BASE_URL}/{endpoint}"
        
        async with httpx.AsyncClient() as client:
            try:
                response = await client.get(url, headers=headers, params=params, timeout=30.0)
                response.raise_for_status()
                return response.json()
            except httpx.HTTPStatusError as e:
                return {
                    "error": f"HTTP error occurred: {e}",
                    "details": str(e)
                }
            
    #Resources for specific location details
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 but offers minimal information. It mentions what the tool does but doesn't cover critical aspects like whether this is a read-only operation, rate limits, authentication requirements, or what the return format looks like. The description is functional but lacks depth for a tool with 3 parameters.

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 and appropriately sized - a clear purpose statement followed by parameter explanations. Every sentence adds value, though the formatting with 'Args:' could be slightly more polished for MCP standards.

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?

For a tool with 3 parameters, no annotations, and no output schema, the description is insufficient. It explains what the tool does and the parameters but doesn't cover return values, error conditions, or behavioral constraints. The agent would need to guess about the response format and operational characteristics.

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

Parameters4/5

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

The description adds meaningful context for all 3 parameters beyond the schema, which has 0% description coverage. It explains that latitude/longitude are coordinates and provides examples for the category parameter ('hotels', 'restaurants', 'attractions'), which helps the agent understand how to use these parameters correctly.

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 with a specific verb ('Find') and resource ('locations near a specific latitude and longitude'), making it immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'search_locations' or 'get_location_details_tool', which prevents a perfect score.

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 'plan_vacation'. There's no mention of prerequisites, constraints, or typical use cases, leaving the agent to guess based on tool names alone.

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

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