Skip to main content
Glama

get_sea_forecast

Retrieve sea state forecasts for Portuguese coastal areas, including wave height, period, direction, and sea temperature for up to three days ahead.

Instructions

Get sea state forecast for Portuguese coastal areas (Previsão Estado do Mar até 3 dias).

Args:
    location_name: Name of coastal location (e.g., 'Porto', 'Lisboa', 'Faro', 'Funchal', 'Leiria').
                  Leave empty to see all available locations.
    day: Forecast day (0=today, 1=tomorrow, 2=day after tomorrow). Valid range: 0-2

Returns sea state forecast including wave height, period, direction, and sea temperature.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
location_nameNo
dayNo

Implementation Reference

  • The handler function decorated with @mcp.tool(), which registers it as an MCP tool and implements the core logic: fetches sea forecast from IPMA API for specified day, optionally filters by location, maps location names, and formats output with wave heights, periods, directions, and sea temperatures.
    @mcp.tool()
    async def get_sea_forecast(location_name: str = "", day: int = 0) -> str:
        """Get sea state forecast for Portuguese coastal areas (Previsão Estado do Mar até 3 dias).
        
        Args:
            location_name: Name of coastal location (e.g., 'Porto', 'Lisboa', 'Faro', 'Funchal', 'Leiria').
                          Leave empty to see all available locations.
            day: Forecast day (0=today, 1=tomorrow, 2=day after tomorrow). Valid range: 0-2
        
        Returns sea state forecast including wave height, period, direction, and sea temperature.
        """
        if day < 0 or day > 2:
            return "Invalid day parameter. Please use 0 (today), 1 (tomorrow), or 2 (day after tomorrow)."
        
        # Get sea forecast
        forecast_url = f"{IPMA_API_BASE}/forecast/oceanography/daily/hp-daily-sea-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 sea forecast data."
        
        # Get location names
        locations_url = f"{IPMA_API_BASE}/sea-locations.json"
        locations_data = await make_ipma_request(locations_url)
        
        # Create location mapping
        location_map = {}
        if locations_data and isinstance(locations_data, list):
            for loc in locations_data:
                location_map[loc.get('globalIdLocal')] = loc.get('local', 'Unknown')
        
        result = f"""Sea State Forecast
    Forecast Date: {forecast_data.get('forecastDate', 'Unknown')}
    Owner: {forecast_data.get('owner', 'IPMA')}
    
    """
        
        if not location_name:
            # Show all locations
            result += f"Available Locations ({len(forecast_data['data'])} total):\n\n"
            for location in forecast_data['data'][:10]:
                loc_id = location.get('globalIdLocal')
                loc_name = location_map.get(loc_id, f"ID: {loc_id}")
                result += f"""Location: {loc_name}
    Position: {location.get('latitude', 'N/A')}°N, {location.get('longitude', 'N/A')}°E
    Wave Height: {location.get('waveHighMin', 'N/A')}m - {location.get('waveHighMax', 'N/A')}m
    Total Sea: {location.get('totalSeaMin', 'N/A')}m - {location.get('totalSeaMax', 'N/A')}m
    Wave Period: {location.get('wavePeriodMin', 'N/A')}s - {location.get('wavePeriodMax', 'N/A')}s
    Wave Direction: {location.get('predWaveDir', 'N/A')}
    Sea Temperature: {location.get('sstMin', 'N/A')}°C - {location.get('sstMax', 'N/A')}°C
    ---
    """
        else:
            # Search for specific location
            location_name_lower = location_name.lower()
            found = False
            
            for location in forecast_data['data']:
                loc_id = location.get('globalIdLocal')
                loc_name = location_map.get(loc_id, '')
                
                if location_name_lower in loc_name.lower():
                    found = True
                    result += f"""Location: {loc_name}
    Position: {location.get('latitude', 'N/A')}°N, {location.get('longitude', 'N/A')}°E
    Wave Height: {location.get('waveHighMin', 'N/A')}m - {location.get('waveHighMax', 'N/A')}m
    Total Sea: {location.get('totalSeaMin', 'N/A')}m - {location.get('totalSeaMax', 'N/A')}m
    Wave Period: {location.get('wavePeriodMin', 'N/A')}s - {location.get('wavePeriodMax', 'N/A')}s
    Wave Direction: {location.get('predWaveDir', 'N/A')}
    Sea Temperature: {location.get('sstMin', 'N/A')}°C - {location.get('sstMax', 'N/A')}°C
    """
                    break
            
            if not found:
                available = [location_map.get(loc.get('globalIdLocal'), f"ID: {loc.get('globalIdLocal')}") 
                            for loc in forecast_data['data'][:10]]
                result += f"Location '{location_name}' not found.\nAvailable locations: {', '.join(available)}"
        
        return result
Behavior2/5

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

With no annotations provided, the description carries full burden but lacks critical behavioral details. It doesn't mention rate limits, authentication requirements, data freshness, error conditions, or whether this is a read-only operation. The description only covers basic functionality without operational context.

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 appropriately sized with clear sections: purpose statement, parameter explanations, and return value description. Every sentence adds value, though the Portuguese parenthetical could be considered slightly extraneous. The structure is front-loaded with the core purpose.

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

Completeness3/5

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

Given no annotations and no output schema, the description provides adequate basic information about what the tool does and its parameters, but lacks details about return format structure, error handling, and operational constraints. For a forecast tool with two parameters, it's minimally viable but leaves gaps in behavioral context.

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 substantial value beyond the schema's 0% coverage. It explains that location_name can be left empty to see all available locations, provides concrete examples of valid values, defines the day parameter's encoding (0=today, 1=tomorrow, 2=day after tomorrow), and specifies the valid range. This compensates fully for the schema's lack of descriptions.

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 sea state forecast'), resource ('Portuguese coastal areas'), and temporal scope ('up to 3 days'). It distinguishes from siblings by focusing on sea state rather than weather, fire risk, seismic data, or other forecast types mentioned in the sibling list.

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 through its parameter explanations (e.g., 'Leave empty to see all available locations'), but doesn't explicitly state when to use this tool versus alternatives like 'get_forecast' or 'get_daily_aggregate_forecast'. No guidance on exclusions or prerequisites is provided.

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