Skip to main content
Glama

get_locations

Retrieve all available cities and locations in Portugal for accessing weather forecasts and meteorological data from IPMA.

Instructions

Listar todas as cidades/locais disponíveis para previsão

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function that fetches the list of locations from the IPMA API, groups them by district, and returns a formatted text response listing all available cities/locations.
    private async getLocations() {
      try {
        const response = await fetch(`${this.baseUrl}/distrits-islands.json`);
        const data = await response.json() as ApiResponse<Location>;
    
        let result = "📍 **Locais Disponíveis para Previsão**\n\n";
        
        // Agrupar por distrito/região
        const groupedByDistrict: { [key: number]: Location[] } = {};
        
        data.data.forEach((location: Location) => {
          if (!groupedByDistrict[location.idDistrito]) {
            groupedByDistrict[location.idDistrito] = [];
          }
          groupedByDistrict[location.idDistrito].push(location);
        });
    
        Object.values(groupedByDistrict).forEach((locations: Location[]) => {
          // Assumir que todas as localizações no grupo têm o mesmo distrito
          result += `**Região ${locations[0].idDistrito}:**\n`;
          locations.forEach((loc: Location) => {
            result += `• ${loc.local} (${loc.latitude}, ${loc.longitude})\n`;
          });
          result += "\n";
        });
    
        return {
          content: [
            {
              type: "text",
              text: result
            }
          ]
        };
      } catch (error) {
        const errorMessage = error instanceof Error ? error.message : String(error);
        throw new McpError(ErrorCode.InternalError, `Erro ao obter locais: ${errorMessage}`);
      }
    }
  • Defines the input schema for the get_locations tool: an empty object (no parameters required). Also includes name and description.
    {
      name: "get_locations",
      description: "Listar todas as cidades/locais disponíveis para previsão",
      inputSchema: {
        type: "object",
        properties: {}
      }
    },
  • src/index.ts:215-216 (registration)
    Registers the tool handler by dispatching calls to the getLocations() method in the CallToolRequest handler.
    case "get_locations":
      return await this.getLocations();
  • TypeScript interface defining the structure of location data used in the getLocations handler.
    interface Location {
      idRegiao: number;
      idAreaAviso: string;
      idConcelho: number;
      globalIdLocal: number;
      latitude: string;
      idDistrito: number;
      local: string;
      longitude: string;
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. While 'Listar todas' implies a read-only operation that returns all available locations, it doesn't specify format, pagination, rate limits, authentication needs, or what 'disponíveis para previsão' means operationally. For a tool with zero annotation coverage, this leaves significant behavioral gaps.

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 a single, efficient sentence in Portuguese that directly states what the tool does. It's appropriately sized for a simple listing tool with no parameters, with zero wasted words or redundant information. 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 the tool's simplicity (0 parameters, no output schema, no annotations), the description is adequate but has clear gaps. It explains what the tool returns (locations available for forecasting) but doesn't specify format, scope limitations, or how it relates to sibling forecasting tools. For a basic listing tool, it meets minimum requirements but could better contextualize within the server's weather/seismic forecasting ecosystem.

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 0 parameters with 100% schema description coverage (empty schema). The description appropriately doesn't discuss parameters since none exist. It earns a 4 because it correctly focuses on the tool's purpose without unnecessary parameter discussion, though it doesn't add value beyond the schema (which is fine for zero parameters).

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

Purpose4/5

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

The description clearly states the action ('Listar todas' - list all) and the resource ('cidades/locais disponíveis para previsão' - cities/locations available for forecasting), providing a specific verb+resource combination. However, it doesn't explicitly differentiate from sibling tools like 'get_weather_stations' which might also provide location-related data, so it doesn't reach the highest score.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites, context for usage, or how it differs from sibling tools like 'get_weather_stations' which might provide similar location data. The agent must infer usage from the name and description alone.

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

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