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;
    }

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

B3.1/5.0
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.