Skip to main content
Glama

list_weather_stations

Retrieve a comprehensive list of MeteoSwiss weather stations across Switzerland to access meteorological data sources.

Instructions

List all available MeteoSwiss weather stations in Switzerland

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler logic for the 'list_weather_stations' tool. It fetches station data from the API and formats it using 'compactWeatherStations'.
    case "list_weather_stations": {
      const url = buildUrl(`${BASE}/smn/locations`, { app: "mcp-swiss" });
      const data = await fetchJSON<ApiResponse>(url);
      const payload = (data?.payload ?? {}) as Record<string, StationEntry>;
      const stations = compactWeatherStations(payload);
      return JSON.stringify({ count: Object.keys(stations).length, stations });
    }
  • The tool definition for 'list_weather_stations', including its description and empty input schema.
    {
      name: "list_weather_stations",
      description: "List all available MeteoSwiss weather stations in Switzerland",
      inputSchema: {
        type: "object",
        properties: {},
      },
    },
  • Helper function that parses and formats raw weather station data for the 'list_weather_stations' tool.
    function compactWeatherStations(payload: Record<string, StationEntry>): Record<string, string> {
      const result: Record<string, string> = {};
      for (const s of Object.values(payload)) {
        const code = s.details?.id ?? s.name;
        const name = s.details?.name ?? s.name;
        const canton = s.details?.canton;
        result[code] = canton ? `${name} (${canton})` : name;
      }
      return result;
    }

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/vikramgorla/mcp-swiss'

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