Skip to main content
Glama
wolkwork

KNMI Weather MCP

by wolkwork

what_is_the_weather_like_in

Get current weather conditions and forecasts for any location in the Netherlands using real-time data from KNMI weather stations.

Instructions

Get and interpret weather data for a location in the Netherlands

Args:
    location: City or place name in the Netherlands
Returns:
    A natural language interpretation of the current weather conditions

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
locationYes

Implementation Reference

  • The core handler function for the 'what_is_the_weather_like_in' MCP tool. It is registered via @mcp.tool() decorator, fetches coordinates and weather data, and generates a natural language summary using a helper prompt.
    @mcp.tool()
    async def what_is_the_weather_like_in(location: str, ctx: Context) -> str:
        """
        Get and interpret weather data for a location in the Netherlands
    
        Args:
            location: City or place name in the Netherlands
        Returns:
            A natural language interpretation of the current weather conditions
        """
        try:
            # Get the coordinates for the location
            coords = await get_coordinates(location)
    
            # Get the weather data
            weather_data = await weather_service.get_weather_by_location(location, ctx)
    
            # Convert to dict and ensure all fields are present
            data_dict = weather_data.dict()
    
            # Add location information
            data_dict["requested_location"] = location
            data_dict["location_coordinates"] = {
                "latitude": coords.latitude,
                "longitude": coords.longitude,
            }
    
            # Use the interpretation prompt to analyze it
            return weather_interpretation(data_dict)
        except Exception as e:
            logger.error(f"Error getting weather for {location}: {str(e)}")
            return f"Error: Unable to get weather data for {location}. {str(e)}"
  • Supporting prompt function invoked by the tool handler to format raw weather data into a structured prompt for natural language interpretation.
    @mcp.prompt()
    def weather_interpretation(raw_data: Dict[str, Any]) -> str:
        """Help Claude interpret raw weather data"""
        try:
            location = raw_data.get("requested_location", "Unknown location")
            coords = raw_data.get("location_coordinates", {})
            lat = coords.get("latitude", 0.0)
            lon = coords.get("longitude", 0.0)
            station_name = raw_data.get("station_name", "Unknown station")
            station_id = raw_data.get("station_id", "Unknown ID")
            timestamp = raw_data.get("timestamp", "Unknown time")
    
            return f"""Please analyze this weather data from KNMI and provide:
            1. A clear summary of current conditions
            2. Important weather measurements and their values
            3. Any notable patterns or extreme values
            4. Relevant clothing advice based on the conditions
            
            Location: {location} ({lat:.3f}°N, {lon:.3f}°E)
            Weather station: {station_name} ({station_id}) at {timestamp}
            
            Current measurements:
            - Temperature: {raw_data.get("temperature", "N/A")}°C
            - Humidity: {raw_data.get("humidity", "N/A")}%
            - Wind Speed: {raw_data.get("wind_speed", "N/A")} m/s
            - Wind Direction: {raw_data.get("wind_direction", "N/A")} degrees
            - Precipitation: {raw_data.get("precipitation", "N/A")} mm
            - Visibility: {raw_data.get("visibility", "N/A")} meters
            - Pressure: {raw_data.get("pressure", "N/A")} hPa
            """
        except Exception as e:
            logger.error(f"Error formatting weather interpretation: {str(e)}")
            return "Error: Unable to interpret weather data due to missing or invalid data."

Tool Definition Quality

Score is being calculated. Check back soon.

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/wolkwork/knmi-mcp'

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