Skip to main content
Glama
wpnbos

Buienradar MCP Server

by wpnbos

get_precipitation_for

Retrieve precise 2-hour precipitation forecasts for any location using latitude and longitude coordinates, enabling accurate weather planning.

Instructions

Fetches precipitation data for the next 2 hours from Buienradar.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
latYes
lonYes

Implementation Reference

  • server.py:41-47 (handler)
    Main handler function implementing the tool logic: fetches raw precipitation data via API and formats it for output.
    async def get_precipitation_for(lat: float, lon: float) -> str:
        """Fetches precipitation data for the next 2 hours from Buienradar."""
        data = await make_request(format_url(lat, lon))
        if not data:
            return "Could not get precipitation data."
        
        return format_response(data)
  • server.py:40-40 (registration)
    Registers the tool using FastMCP's @mcp.tool() decorator, which uses the function name 'get_precipitation_for'.
    @mcp.tool()
  • Helper function to construct the Buienradar API URL from latitude and longitude.
    def format_url(lat: float, lon: float) -> str:
        lat = round(lat, 2)
        lon = round(lon, 2)
        return f"https://gadgets.buienradar.nl/data/raintext/?lat={lat}&lon={lon}"
  • Async helper to perform HTTP GET request to the API and return raw text or None on error.
    async def make_request(url) -> str | None:
        headers = {"User-Agent": USER_AGENT}
        try:
            async with httpx.AsyncClient() as client:
                response = await client.get(url, headers=headers, timeout=30)
                response.raise_for_status()
        except Exception as e:
            return None
    
        return response.text
  • Helper to parse raw API response and convert to formatted CSV-like string with mm per hour.
    def format_response(data: str) -> str:
        result = ["time, mm per hour"]
        for line in data.strip().split('\n'):
            intensity, time = line.split("|")
            intensity = int(intensity)
            mm_per_hour = round(10 ** ((intensity - 109) / 32), 1)
            result.append(f"{time}, {mm_per_hour}")
    
        return "\n".join(result)

Tool Definition Quality

Score is being calculated. Check back soon.

Install Server

Other Tools

Related 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/wpnbos/buienradar-mcp-server'

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