Skip to main content
Glama

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 main handler function for the 'search_nearby_locations' tool. It constructs parameters with latLong and category, then calls the make_api_request helper to fetch data from Tripadvisor's location/search endpoint.
    @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)
  • Helper function used by search_nearby_locations (and other tools) to make authenticated HTTP GET 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()

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