get_location_details
Retrieve comprehensive details about a specific Tripadvisor location using its ID, including descriptions, amenities, and contact information.
Instructions
Get detailed information about a specific location
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| locationId | Yes | ||
| language | No | en |
Implementation Reference
- src/tripadvisor_mcp/server.py:105-125 (handler)The handler function for the 'get_location_details' tool, registered via @mcp.tool decorator. Includes input schema via type annotations and docstring. Fetches detailed location information from Tripadvisor API using the make_api_request helper.@mcp.tool(description="Get detailed information about a specific location") async def get_location_details( locationId: Union[str, int], language: str = "en", ) -> Dict[str, Any]: """ Get detailed information about a specific location (hotel, restaurant, or attraction). Parameters: - locationId: Tripadvisor location ID (can be string or integer) - language: Language code (default: 'en') """ params = { "language": language, } # Convert locationId to string to ensure compatibility location_id_str = str(locationId) return await make_api_request(f"location/{location_id_str}/details", params)
- src/tripadvisor_mcp/server.py:105-105 (registration)The @mcp.tool decorator registers the get_location_details function as an MCP tool.@mcp.tool(description="Get detailed information about a specific location")
- src/tripadvisor_mcp/server.py:24-42 (helper)Helper function used by get_location_details to make authenticated API requests to Tripadvisor.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()
- Input schema defined by function parameters type hints and docstring description.locationId: Union[str, int], language: str = "en", ) -> Dict[str, Any]: """ Get detailed information about a specific location (hotel, restaurant, or attraction). Parameters: - locationId: Tripadvisor location ID (can be string or integer) - language: Language code (default: 'en') """