Skip to main content
Glama

list_available_cities

Retrieve all Portuguese cities and islands available for weather forecasts, including district capitals and archipelagos like Madeira and Azores.

Instructions

List all available Portuguese cities and islands for weather forecasts.

Returns a comprehensive list of all locations available in the IPMA database,
including district capitals and islands (Madeira and Azores).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler function for the list_available_cities tool. It fetches the list of cities from IPMA API endpoint 'distrits-islands.json', groups them by region (Continental Portugal, Madeira, Azores), formats a string output listing up to 30 continental cities and all islands, using the helper make_ipma_request.
    @mcp.tool()
    async def list_available_cities() -> str:
        """List all available Portuguese cities and islands for weather forecasts.
        
        Returns a comprehensive list of all locations available in the IPMA database,
        including district capitals and islands (Madeira and Azores).
        """
        cities_url = f"{IPMA_API_BASE}/distrits-islands.json"
        cities_data = await make_ipma_request(cities_url)
        
        if not cities_data or "data" not in cities_data:
            return "Unable to fetch cities database."
        
        result = f"Available Portuguese Cities and Islands ({len(cities_data['data'])} total)\n\n"
        
        # Group by region
        continente = []
        madeira = []
        acores = []
        
        for entry in cities_data["data"]:
            location_info = f"{entry.get('local')} (ID: {entry.get('globalIdLocal')})"
            region_id = entry.get('idRegiao', 0)
            
            if region_id == 1:
                continente.append(location_info)
            elif region_id == 2:
                madeira.append(location_info)
            elif region_id == 3:
                acores.append(location_info)
        
        result += f"CONTINENTAL PORTUGAL ({len(continente)} locations):\n"
        result += "\n".join(continente[:30])
        if len(continente) > 30:
            result += f"\n... and {len(continente) - 30} more\n"
        
        result += f"\n\nMADEIRA ARCHIPELAGO ({len(madeira)} locations):\n"
        result += "\n".join(madeira)
        
        result += f"\n\nAZORES ARCHIPELAGO ({len(acores)} locations):\n"
        result += "\n".join(acores)
        
        return result
  • Helper function used by list_available_cities (and other tools) to make HTTP requests to the IPMA API with error handling and timeout.
    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:453-453 (registration)
    The @mcp.tool() decorator registers the list_available_cities function as an MCP tool.
    @mcp.tool()
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions the data source ('IPMA database') and scope ('comprehensive list'), but doesn't address important behavioral aspects like whether this is a static list or dynamically updated, potential rate limits, authentication requirements, or what format the list returns (e.g., structured data vs. raw text).

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 in two sentences: the first states the purpose and scope, the second clarifies what's included in the return. Every word adds value with no redundancy or unnecessary elaboration.

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?

For a simple list-retrieval tool with no parameters and no output schema, the description provides adequate purpose and scope information. However, without annotations or output schema, it lacks details about return format, data freshness, or error conditions that would be helpful for an agent to use it effectively.

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?

The tool has zero parameters, and the schema description coverage is 100% (though trivial since there are no parameters). The description appropriately doesn't discuss parameters, focusing instead on what the tool returns. This meets the baseline expectation for a parameterless tool.

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 ('List all available Portuguese cities and islands') and resource ('weather forecasts'), distinguishing it from siblings that retrieve actual weather data rather than location metadata. It explicitly mentions the scope ('IPMA database') and types of locations included ('district capitals and islands').

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 implies usage context by stating this tool provides 'available locations for weather forecasts,' suggesting it should be used to identify valid inputs for forecast-related siblings. However, it doesn't explicitly state when NOT to use it or name specific alternatives among the siblings for different purposes.

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