Skip to main content
Glama

get_weather_warnings

Retrieve active Portuguese weather warnings for up to 3 days, including type, severity level, affected areas, and timing information.

Instructions

Get Portuguese meteorological warnings for up to 3 days.

Returns current active weather warnings (Avisos Meteorológicos) including:
- Warning type (precipitation, wind, fog, maritime agitation, etc.)
- Awareness level (green, yellow, orange, red)
- Affected area
- Start and end times

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'get_weather_warnings' tool. Decorated with @mcp.tool() for registration. Fetches weather warnings data from IPMA API, filters active warnings (non-green), and formats them into a readable string output.
    @mcp.tool()
    async def get_weather_warnings() -> str:
        """Get Portuguese meteorological warnings for up to 3 days.
        
        Returns current active weather warnings (Avisos Meteorológicos) including:
        - Warning type (precipitation, wind, fog, maritime agitation, etc.)
        - Awareness level (green, yellow, orange, red)
        - Affected area
        - Start and end times
        """
        warnings_url = f"{IPMA_API_BASE}/forecast/warnings/warnings_www.json"
        warnings_data = await make_ipma_request(warnings_url)
        
        if not warnings_data:
            return "Unable to fetch weather warnings data."
        
        # Filter active warnings (not green level)
        active_warnings = [w for w in warnings_data if w.get("awarenessLevelID") != "green"]
        
        if not active_warnings:
            return "No active weather warnings at this time. All areas are at green (normal) level."
        
        result = "Active Weather Warnings:\n\n"
        for warning in active_warnings:
            result += f"""Area: {warning.get('idAreaAviso', 'N/A')}
    Type: {warning.get('awarenessTypeName', 'N/A')}
    Level: {warning.get('awarenessLevelID', 'N/A').upper()}
    Description: {warning.get('text', 'N/A')}
    Start: {warning.get('startTime', 'N/A')}
    End: {warning.get('endTime', 'N/A')}
    ---
    """
        
        return result
  • Helper utility function used by get_weather_warnings to make asynchronous HTTP requests to the IPMA API endpoints with timeout and error handling.
    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:23-23 (registration)
    The @mcp.tool() decorator registers the get_weather_warnings function as an MCP tool on the FastMCP server instance.
    @mcp.tool()
  • Constant defining the base URL for IPMA API calls, used in constructing the warnings endpoint URL.
    IPMA_API_BASE = "https://api.ipma.pt/open-data"
Behavior3/5

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

With no annotations provided, the description carries full disclosure burden. It usefully describes the return content structure (warning types, awareness levels, affected areas, time ranges) but doesn't mention potential limitations like data freshness, API rate limits, or error conditions that would help an agent use it appropriately.

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 efficiently structured with a clear purpose statement followed by bullet points detailing return values. Every sentence earns its place, with no redundant information or unnecessary elaboration.

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?

For a zero-parameter tool with no output schema, the description provides excellent coverage of what the tool returns. It could be more complete by mentioning data source or update frequency, but it adequately explains the core functionality and output structure.

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

Parameters4/5

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

With 0 parameters and 100% schema coverage, the baseline is 4. The description appropriately doesn't discuss parameters since none exist, focusing instead on what the tool returns when invoked without inputs.

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 Portuguese meteorological warnings') with precise scope ('for up to 3 days'), distinguishing it from siblings like get_forecast or get_fire_risk by focusing on active warnings rather than forecasts or other data types.

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

Usage Guidelines3/5

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

The description implies usage context through the 'active weather warnings' focus and 3-day limit, suggesting this tool is for current alert situations rather than general forecasting. However, it doesn't explicitly state when to choose this over alternatives like get_forecast or list_available_cities.

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