search_location
Find locations in the Netherlands to access real-time weather data from KNMI weather stations for temperature, humidity, and wind speed.
Instructions
Search for locations in the Netherlands
Args:
query: Search term for location
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes |
Implementation Reference
- src/knmi_weather_mcp/server.py:115-143 (handler)The handler function implementing the 'search_location' tool. It performs a geocoding search using the OpenStreetMap Nominatim API for locations in the Netherlands, returning a list of up to 5 results with name, type, latitude, and longitude.@mcp.tool() async def search_location(query: str, ctx: Context) -> List[Dict[str, str]]: """ Search for locations in the Netherlands Args: query: Search term for location """ async with httpx.AsyncClient() as client: response = await client.get( "https://nominatim.openstreetmap.org/search", params={"q": f"{query}, Netherlands", "format": "json", "limit": 5}, headers={"User-Agent": "KNMI_Weather_MCP/1.0"}, ) response.raise_for_status() results = [] for place in response.json(): results.append( { "name": place["display_name"], "type": place["type"], "latitude": place["lat"], "longitude": place["lon"], } ) return results