Skip to main content
Glama

get_fire_risk

Retrieve fire risk forecasts for Portuguese municipalities to assess wildfire danger levels up to two days ahead.

Instructions

Get fire risk forecast for Portugal (Previsão Risco de Incêndio até 2 dias).

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

Returns fire risk classification (RCM - Risco de Incêndio) for Portuguese municipalities.
Fire risk levels: 1=Low, 2=Moderate, 3=High, 4=Very High, 5=Maximum

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dayNo

Implementation Reference

  • The handler function for the get_fire_risk tool, including registration via @mcp.tool() decorator, input validation, API call to IPMA for fire risk data, and formatted output of risk levels for Portuguese municipalities.
    @mcp.tool()
    async def get_fire_risk(day: int = 0) -> str:
        """Get fire risk forecast for Portugal (Previsão Risco de Incêndio até 2 dias).
        
        Args:
            day: Forecast day (0=today, 1=tomorrow). Valid range: 0-1
        
        Returns fire risk classification (RCM - Risco de Incêndio) for Portuguese municipalities.
        Fire risk levels: 1=Low, 2=Moderate, 3=High, 4=Very High, 5=Maximum
        """
        if day < 0 or day > 1:
            return "Invalid day parameter. Please use 0 (today) or 1 (tomorrow)."
        
        fire_url = f"{IPMA_API_BASE}/forecast/meteorology/rcm/rcm-d{day}.json"
        fire_data = await make_ipma_request(fire_url)
        
        if not fire_data or "local" not in fire_data:
            return "Unable to fetch fire risk data."
        
        result = f"""Fire Risk Forecast (RCM - Risco de Incêndio)
    Forecast Date: {fire_data.get('dataPrev', 'Unknown')}
    Model Run Date: {fire_data.get('dataRun', 'Unknown')}
    File Date: {fire_data.get('fileDate', 'Unknown')}
    
    Fire Risk Levels: 1=Low, 2=Moderate, 3=High, 4=Very High, 5=Maximum
    
    Sample Municipalities (first 20):
    """
        
        count = 0
        for dico, location in fire_data['local'].items():
            if count >= 20:
                break
            
            rcm_value = location.get('data', {}).get('rcm', 'N/A')
            risk_label = {1: 'Low', 2: 'Moderate', 3: 'High', 4: 'Very High', 5: 'Maximum'}.get(rcm_value, 'Unknown')
            
            result += f"""
    Municipality Code: {dico}
    Position: {location.get('latitude', 'N/A')}°N, {location.get('longitude', 'N/A')}°E
    Fire Risk: {rcm_value} ({risk_label})
    ---"""
            count += 1
        
        total_locations = len(fire_data['local'])
        result += f"\n\nTotal Municipalities: {total_locations}"
        
        return result
Behavior3/5

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

With no annotations provided, the description carries full burden. It discloses key behavioral aspects: geographic limitation (Portugal only), temporal scope (2-day forecast), and return format (RCM classification with level definitions). However, it doesn't mention rate limits, authentication requirements, data freshness, or error conditions that would be helpful for an agent.

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

Conciseness4/5

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

The description is well-structured with clear sections (purpose, args, returns) and efficiently conveys necessary information. Every sentence earns its place, though the fire risk levels could be presented more concisely. The information is appropriately front-loaded with the core purpose first.

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 single-parameter tool with no annotations and no output schema, the description provides good coverage: clear purpose, parameter documentation, return format explanation, and classification scale. It could be more complete by mentioning data source, update frequency, or municipality granularity, but covers the essentials well given the tool's simplicity.

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 value beyond the input schema, which has 0% description coverage. It fully documents the single parameter 'day' with its semantics (forecast day), valid values (0-1), and meaning (0=today, 1=tomorrow). This completely compensates for the schema's lack of documentation.

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 tool's purpose with specific verb ('Get'), resource ('fire risk forecast'), and geographic scope ('for Portugal'). It distinguishes from siblings by focusing specifically on fire risk rather than general weather, seismic, or UV forecasts. The title 'Previsão Risco de Incêndio até 2 dias' reinforces the specific domain.

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 geographic limitation ('for Portugal') and temporal scope ('until 2 days'), but doesn't explicitly state when to use this tool versus alternatives like get_forecast or get_weather_warnings. No guidance is provided about when this tool is preferred over sibling tools for fire-related queries.

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