Skip to main content
Glama
robobobby

mcp-norwegian-weather

by robobobby

current_weather

Get current weather conditions for any location in Norway, including cities and coordinates, using MET Norway data.

Instructions

Get current weather for a location in Norway using MET Norway (yr.no).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
locationYesNorwegian city name or lat,lon coordinates

Implementation Reference

  • src/index.js:108-136 (registration)
    Tool registration: The current_weather tool is registered with the MCP server using server.tool() with its name, description, input schema, and handler function.
    server.tool(
      "current_weather",
      "Get current weather for a location in Norway using MET Norway (yr.no).",
      { location: z.string().describe("Norwegian city name or lat,lon coordinates") },
      async ({ location }) => {
        try {
          const loc = await getLocation(location);
          const data = await fetchForecast(loc.lat, loc.lon);
          const now = data.properties.timeseries[0];
          const inst = now.data.instant.details;
          const symbol = now.data.next_1_hours?.summary?.symbol_code || now.data.next_6_hours?.summary?.symbol_code || "";
          const precip1h = now.data.next_1_hours?.details?.precipitation_amount;
          const lines = [
            `## ${loc.name} — Current Weather`,
            `**Conditions:** ${symbolToText(symbol)}`,
            `**Temperature:** ${inst.air_temperature}°C`,
            `**Humidity:** ${inst.relative_humidity}%`,
            `**Wind:** ${inst.wind_speed} m/s from ${inst.wind_from_direction}° (gusts ${inst.wind_speed_of_gust ?? "N/A"} m/s)`,
            `**Pressure:** ${inst.air_pressure_at_sea_level} hPa`,
            `**Cloud cover:** ${inst.cloud_area_fraction}%`,
            precip1h != null ? `**Precipitation (next hour):** ${precip1h} mm` : null,
            `\n*MET Norway Locationforecast 2.0 — ${now.time}*`,
          ].filter(Boolean);
          return { content: [{ type: "text", text: lines.join("\n") }] };
        } catch (err) {
          return { content: [{ type: "text", text: `Error: ${err.message}` }], isError: true };
        }
      }
    );
  • Tool handler implementation: The async function that executes the tool logic - resolves location, fetches forecast from MET Norway API, extracts current weather data, and formats it into a readable markdown response.
    async ({ location }) => {
      try {
        const loc = await getLocation(location);
        const data = await fetchForecast(loc.lat, loc.lon);
        const now = data.properties.timeseries[0];
        const inst = now.data.instant.details;
        const symbol = now.data.next_1_hours?.summary?.symbol_code || now.data.next_6_hours?.summary?.symbol_code || "";
        const precip1h = now.data.next_1_hours?.details?.precipitation_amount;
        const lines = [
          `## ${loc.name} — Current Weather`,
          `**Conditions:** ${symbolToText(symbol)}`,
          `**Temperature:** ${inst.air_temperature}°C`,
          `**Humidity:** ${inst.relative_humidity}%`,
          `**Wind:** ${inst.wind_speed} m/s from ${inst.wind_from_direction}° (gusts ${inst.wind_speed_of_gust ?? "N/A"} m/s)`,
          `**Pressure:** ${inst.air_pressure_at_sea_level} hPa`,
          `**Cloud cover:** ${inst.cloud_area_fraction}%`,
          precip1h != null ? `**Precipitation (next hour):** ${precip1h} mm` : null,
          `\n*MET Norway Locationforecast 2.0 — ${now.time}*`,
        ].filter(Boolean);
        return { content: [{ type: "text", text: lines.join("\n") }] };
      } catch (err) {
        return { content: [{ type: "text", text: `Error: ${err.message}` }], isError: true };
      }
    }
  • Input schema: Zod schema defining the location parameter as a required string describing Norwegian city name or lat,lon coordinates.
    { location: z.string().describe("Norwegian city name or lat,lon coordinates") },
  • Helper function getLocation: Resolves user input to a location by checking known Norwegian cities or using geocoding API, throws error if location not found.
    async function getLocation(input) {
      const loc = resolveLocation(input);
      if (loc) return loc;
      const geo = await geocode(input);
      if (geo) return geo;
      throw new Error(`Could not find location "${input}" in Norway. Try a city name or lat,lon coordinates.`);
    }
  • Helper function fetchForecast: Fetches weather forecast data from MET Norway Locationforecast 2.0 API for given latitude and longitude.
    async function fetchForecast(lat, lon) {
      const url = `${BASE_URL}/complete?lat=${lat.toFixed(4)}&lon=${lon.toFixed(4)}`;
      const res = await fetch(url, { headers: { "User-Agent": USER_AGENT } });
      if (!res.ok) throw new Error(`MET Norway API error (${res.status}): ${await res.text()}`);
      return res.json();
    }
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. It states what the tool does (get current weather) but doesn't describe any behavioral traits like rate limits, authentication requirements, error conditions, response format, or data freshness. For a read operation with no annotation coverage, this leaves significant gaps in understanding how the tool behaves.

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 that communicates the core purpose, geographic scope, and data source without any wasted words. It's appropriately front-loaded with the main action and resource. Every element in the sentence serves a clear informational purpose.

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 that there are no annotations and no output schema, the description should provide more complete context about what to expect from this tool. While it clearly states the purpose and geographic limitation, it doesn't describe the response format, potential errors, or any behavioral constraints. For a tool with no structured metadata beyond the input schema, this leaves the agent with insufficient information to use it effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100% (the 'location' parameter is fully documented in the schema as 'Norwegian city name or lat,lon coordinates'). The description doesn't add any parameter-specific information beyond what's already in the schema. With high schema coverage, the baseline score of 3 is appropriate since the description doesn't compensate with additional parameter context.

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 verb ('Get') and resource ('current weather') with specific geographic scope ('for a location in Norway using MET Norway (yr.no)'). It distinguishes from the sibling 'weather_forecast' by specifying 'current' weather rather than forecast. However, it doesn't explicitly contrast with the sibling tool beyond the temporal difference.

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

Usage Guidelines3/5

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

The description implies when to use this tool (for current weather in Norway) versus the sibling 'weather_forecast' (presumably for future predictions). However, it doesn't provide explicit guidance on when NOT to use it or mention any prerequisites or alternatives beyond the temporal distinction. The geographic limitation is clear but not framed as an exclusion guideline.

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/robobobby/mcp-norwegian-weather'

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