GnistAI GnistAI
Log in

Getting Started with SMHI Weather Warnings (Sweden)

Swedish weather warnings from SMHI — impact-based warnings for meteorological and hydrological events including wind, snow, rain, thunder, fire risk, flooding, and high sea levels.

All Tutorials   |   Overview   |   Playground   |   MCP   |   REST API   |   Home
Environment

Data source: SMHI (Swedish Meteorological and Hydrological Institute)

Overview

SMHI Weather Warnings (Sweden) wraps SMHI (Swedish Meteorological and Hydrological Institute), handling authentication, pagination, and rate limits for you. This tutorial covers all 3 tools with working code examples you can copy and run.

Prerequisites

  1. Sign up at https://context.gnist.ai/signup for a free API key (100 calls/day).
  2. Choose your integration method: MCP protocol or REST API.

Connect via MCP

Add to your MCP client config (Claude Desktop, Cursor, etc.):

MCP Config
{
  "mcpServers": {
    "gnist-smhi-warnings": {
      "url": "https://context.gnist.ai/mcp/smhi-warnings/",
      "headers": {
        "Gnist-API-Key": "YOUR_API_KEY"
      }
    }
  }
}

Tools (3)

get_weather_warnings

Get current SMHI weather warnings for Sweden. Returns active weather warnings from the Swedish Meteorological and Hydrological Institute (SMHI). Warnings cover meteorological events (wind, snow, rain, thunder, fire risk) and hydrological events (flooding, high water levels). Warning levels: MESSAGE (informational), YELLOW (moderate), ORANGE (significant), RED (extreme). Returns: List of warnings with severity, affected areas, and time periods.

ParameterTypeRequiredDescription
warning_levelanyoptionalFilter by warning level code: MESSAGE, YELLOW, ORANGE, or RED. Omit for all levels.
event_typeanyoptionalFilter by event type code: THUNDER, WIND, SNOW, RAIN, FIRE, HIGH_TEMPERATURES, etc. Omit for all types.
curl -X POST "https://context.gnist.ai/mcp/smhi-warnings/" \
  -H "Content-Type: application/json" \
  -H "Gnist-API-Key: YOUR_API_KEY" \
  -d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "get_weather_warnings", "arguments": {"warning_level": "example"}}}'
import httpx

resp = httpx.post(
    "https://context.gnist.ai/mcp/smhi-warnings/",
    headers={"Gnist-API-Key": "YOUR_API_KEY"},
    json={'id': 1,
 'jsonrpc': '2.0',
 'method': 'tools/call',
 'params': {'arguments': {'warning_level': 'example'},
            'name': 'get_weather_warnings'}},
)
print(resp.json())

get_warning_metadata

List available SMHI warning levels and event types. Returns the full set of warning level codes (MESSAGE, YELLOW, ORANGE, RED) and event type codes (THUNDER, WIND, SNOW, etc.) used in Swedish weather warnings. Useful for understanding the classification system before querying active warnings. Returns: Warning levels and event types with their descriptions.

curl -X POST "https://context.gnist.ai/mcp/smhi-warnings/" \
  -H "Content-Type: application/json" \
  -H "Gnist-API-Key: YOUR_API_KEY" \
  -d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "get_warning_metadata", "arguments": {}}}'
import httpx

resp = httpx.post(
    "https://context.gnist.ai/mcp/smhi-warnings/",
    headers={"Gnist-API-Key": "YOUR_API_KEY"},
    json={'id': 1,
 'jsonrpc': '2.0',
 'method': 'tools/call',
 'params': {'arguments': {}, 'name': 'get_warning_metadata'}},
)
print(resp.json())

report_feedback

Report a bug, feature request, or general feedback for this data source. Use this when something doesn't work as expected, when you'd like a new feature, or when you have suggestions for improvement. Args: feedback: Describe the issue or suggestion. feedback_type: One of 'bug', 'feature_request', or 'general'.

ParameterTypeRequiredDescription
feedbackstringrequired
feedback_typestringoptional (default: general)
curl -X POST "https://context.gnist.ai/mcp/smhi-warnings/" \
  -H "Content-Type: application/json" \
  -H "Gnist-API-Key: YOUR_API_KEY" \
  -d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "report_feedback", "arguments": {"feedback": "example"}}}'
import httpx

resp = httpx.post(
    "https://context.gnist.ai/mcp/smhi-warnings/",
    headers={"Gnist-API-Key": "YOUR_API_KEY"},
    json={'id': 1,
 'jsonrpc': '2.0',
 'method': 'tools/call',
 'params': {'arguments': {'feedback': 'example'}, 'name': 'report_feedback'}},
)
print(resp.json())

FAQ

What data does SMHI Weather Warnings (Sweden) provide?

Swedish weather warnings from SMHI — impact-based warnings for meteorological and hydrological events including wind, snow, rain, thunder, fire risk, flooding, and high sea levels. It exposes 3 tools: get_weather_warnings, get_warning_metadata, report_feedback.

What do I need to get started?

A Gnist API key (free tier: 100 calls/day). Sign up at https://context.gnist.ai/signup.

What format does the SMHI Weather Warnings (Sweden) API return?

JSON, via either MCP protocol (JSON-RPC 2.0) or REST API.

Next Steps

Related Tutorials