Skip to main content
Glama

get_weather

Retrieve current weather conditions for Swiss locations using MeteoSwiss station codes like BER, ZUE, or LUG.

Instructions

Get current weather conditions at a Swiss MeteoSwiss station (e.g. BER=Bern, ZUE=Zürich, LUG=Lugano)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
stationYesStation code (e.g. BER, ZUE, LUG, GVE, SMA)

Implementation Reference

  • The handler implementation for the "get_weather" tool, which fetches data from the MeteoSwiss API and formats the response.
    case "get_weather": {
      const url = buildUrl(`${BASE}/smn/latest`, {
        locations: args.station as string,
        app: "mcp-swiss",
        version: "0.1.0",
      });
      const data = await fetchJSON<ApiResponse>(url);
      const payload = data?.payload;
      if (Array.isArray(payload)) {
        const ts = payload[0]?.timestamp;
        const readings: Record<string, number> = {};
        for (const p of payload) {
          const key = PARAM_NAMES[p.par] ?? p.par;
          readings[key] = p.val;
        }
        return JSON.stringify({
          station: args.station,
          timestamp: toISO(ts),
          ...readings,
          source: "MeteoSwiss via SwissMetNet",
        });
      }
      return JSON.stringify(data, null, 2);
    }
  • The definition and input schema for the "get_weather" tool.
    {
      name: "get_weather",
      description: "Get current weather conditions at a Swiss MeteoSwiss station (e.g. BER=Bern, ZUE=Zürich, LUG=Lugano)",
      inputSchema: {
        type: "object",
        required: ["station"],
        properties: {
          station: { type: "string", description: "Station code (e.g. BER, ZUE, LUG, GVE, SMA)" },
        },
      },
    },

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