Skip to main content
Glama

get_daily_aggregate_forecast

Retrieve daily aggregated weather forecasts for all Portuguese locations up to three days ahead, providing comprehensive regional weather data for planning purposes.

Instructions

Get daily aggregated weather forecast for Portugal (Previsão Meteorológica até 3 dias, agregada por dia).

Args:
    day: Forecast day (0=today, 1=tomorrow, 2=day after tomorrow). Valid range: 0-2

Returns aggregated forecast for all Portuguese locations for the specified day.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dayNo

Implementation Reference

  • The main handler function for the 'get_daily_aggregate_forecast' tool. It validates the input day parameter (0-2), fetches aggregated daily weather forecast data from the IPMA API for all Portuguese locations, formats a summary including forecast date, total locations, and sample data from the first 10 locations, returning it as a formatted string.
    @mcp.tool()
    async def get_daily_aggregate_forecast(day: int = 0) -> str:
        """Get daily aggregated weather forecast for Portugal (Previsão Meteorológica até 3 dias, agregada por dia).
        
        Args:
            day: Forecast day (0=today, 1=tomorrow, 2=day after tomorrow). Valid range: 0-2
        
        Returns aggregated forecast for all Portuguese locations for the specified day.
        """
        if day < 0 or day > 2:
            return "Invalid day parameter. Please use 0 (today), 1 (tomorrow), or 2 (day after tomorrow)."
        
        forecast_url = f"{IPMA_API_BASE}/forecast/meteorology/cities/daily/hp-daily-forecast-day{day}.json"
        forecast_data = await make_ipma_request(forecast_url)
        
        if not forecast_data or "data" not in forecast_data:
            return "Unable to fetch daily aggregate forecast data."
        
        result = f"""Daily Aggregate Weather Forecast
    Forecast Date: {forecast_data.get('forecastDate', 'Unknown')}
    Data Updated: {forecast_data.get('dataUpdate', 'Unknown')}
    Owner: {forecast_data.get('owner', 'IPMA')}
    
    Total Locations: {len(forecast_data['data'])}
    
    Sample Forecasts (first 10 locations):
    """
        
        for location in forecast_data['data'][:10]:
            result += f"""
    Location ID: {location.get('globalIdLocal', 'N/A')}
    Position: {location.get('latitude', 'N/A')}°N, {location.get('longitude', 'N/A')}°E
    Temperature: {location.get('tMin', 'N/A')}°C - {location.get('tMax', 'N/A')}°C
    Precipitation Probability: {location.get('precipitaProb', 'N/A')}%
    Weather Type: {location.get('idWeatherType', 'N/A')}
    Wind: {location.get('predWindDir', 'N/A')} (Speed Class: {location.get('classWindSpeed', 'N/A')})
    ---"""
        
        return result
  • Supporting helper utility function used by the tool to make asynchronous HTTP requests to the IPMA API endpoints, handling errors and timeouts gracefully.
    async def make_ipma_request(url: str) -> dict[str, Any] | list[dict[str, Any]] | None:
        """Make a request to the IPMA API with proper error handling."""
        async with httpx.AsyncClient() as client:
            try:
                response = await client.get(url, timeout=30.0)
                response.raise_for_status()
                return response.json()
            except Exception:
                return None
  • weather.py:118-118 (registration)
    The @mcp.tool() decorator registers the get_daily_aggregate_forecast function as an MCP tool with FastMCP.
    @mcp.tool()
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It describes the aggregation scope ('aggregated forecast for all Portuguese locations') and temporal constraints ('until 3 days'), which adds useful context beyond basic functionality. However, it does not cover aspects like rate limits, authentication needs, error conditions, or response format details, leaving gaps for a tool with no annotation support.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded, with the core purpose stated first, followed by parameter details and return clarification. Every sentence earns its place by adding value—no redundant or vague phrasing. The structure efficiently communicates key information without waste.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (1 parameter, no output schema, no annotations), the description is largely complete. It covers purpose, parameter semantics, and scope well. However, it lacks details on the return format (e.g., structure of aggregated data) and any behavioral constraints like rate limits, which would enhance completeness for a forecast tool with no structured output documentation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds significant meaning beyond the input schema, which has 0% description coverage. It explains the 'day' parameter's semantics (forecast day with 0=today mapping), valid range (0-2), and clarifies it returns aggregated data for the specified day. This fully compensates for the schema's lack of documentation, providing essential usage context that the schema alone does not convey.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Get daily aggregated weather forecast'), resource ('for Portugal'), and scope ('aggregated forecast for all Portuguese locations'), distinguishing it from siblings like get_forecast (likely more granular) or get_sea_forecast (different domain). It provides a precise verb+resource combination with explicit geographical and aggregation boundaries.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implicitly suggests usage for daily aggregated forecasts in Portugal, but does not explicitly state when to use this tool versus alternatives like get_forecast or list_available_cities. It provides clear context (Portugal, aggregated, 3-day forecast) but lacks explicit exclusions or named alternatives, missing the highest tier of guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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/gabriel20vieira/ipma-mcp-server'

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