Skip to main content
Glama

get_locations

Retrieve all available cities and locations in Portugal to access 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 main handler function for the 'get_locations' tool. Fetches location data from the IPMA API, groups locations by district, formats them into a markdown text response, and returns it in the MCP content format.
    async getLocations() {
      try {
        const response = await fetch(`${this.baseUrl}/distrits-islands.json`);
        const data = await response.json();
    
        let result = "**Locais Disponíveis para Previsão**\n\n";
        
        const groupedByDistrict = {};
        
        data.data.forEach((location) => {
          if (!groupedByDistrict[location.idDistrito]) {
            groupedByDistrict[location.idDistrito] = [];
          }
          groupedByDistrict[location.idDistrito].push(location);
        });
    
        Object.values(groupedByDistrict).forEach((locations) => {
          result += `**Região ${locations[0].idDistrito}:**\n`;
          locations.forEach((loc) => {
            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}`);
      }
    }
  • src/index.js:74-81 (registration)
    Registers the 'get_locations' tool in the list of tools returned by ListToolsRequestSchema, including its name, description, and input schema.
    {
      name: "get_locations",
      description: "Listar todas as cidades/locais disponíveis para previsão",
      inputSchema: {
        type: "object",
        properties: {}
      }
    },
  • Defines the input schema for the 'get_locations' tool, which requires no parameters (empty properties).
    inputSchema: {
      type: "object",
      properties: {}
    }
  • Part of the CallToolRequestSchema handler that dispatches calls to the 'get_locations' tool by invoking the getLocations() method.
    case "get_locations":
      return await this.getLocations();
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states it lists locations but doesn't describe traits like whether it's read-only, if it requires authentication, rate limits, or what the output format might be (e.g., list of strings, JSON objects). This is a significant gap for a tool with zero annotation coverage.

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 the tool's function without any fluff. It's front-loaded and appropriately sized, making it easy to understand at a glance.

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

Completeness2/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 annotations, no output schema), the description is minimal but incomplete. It doesn't address behavioral aspects like output format or usage context, which are important even for simple tools. With no annotations or output schema, the description should do more to compensate.

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, and schema description coverage is 100%, so there's no need for parameter details in the description. The baseline for 0 parameters is 4, as the description appropriately doesn't waste space on non-existent parameters, and the schema fully covers the input structure.

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 tool's purpose: 'Listar todas as cidades/locais disponíveis para previsão' (List all cities/locations available for forecasting). It specifies the verb 'listar' and the resource 'cidades/locais', making the function unambiguous. However, it doesn't explicitly differentiate from sibling tools like 'get_weather_stations', which might also list locations, 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 sibling tools like 'get_weather_stations' or explain if this is for general location listing versus station-specific data. There's no context on prerequisites or exclusions, leaving usage unclear.

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/brandao-20/mcp_server_ipma'

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