Skip to main content
Glama
nevermined-io

Weather MCP Server

weather_service.py1.64 kB
from dataclasses import dataclass @dataclass class TodayWeather: """ Data model with a minimal snapshot of today's weather. Attributes ---------- city : str City name. country : str | None Country code if known. timezone : str | None Timezone identifier. tmaxC : float | None Expected maximum temperature in Celsius degrees. tminC : float | None Expected minimum temperature in Celsius degrees. precipitationMm : float | None Precipitation in millimeters. weatherText : str | None Human-readable weather summary. """ city: str country: str | None = None timezone: str | None = None tmaxC: float | None = None tminC: float | None = None precipitationMm: float | None = None weatherText: str | None = None def sanitize_city(city: str) -> str: """ Normalize a user-provided city string. Parameters ---------- city : str Raw city input. Returns ------- str Trimmed and title-cased city name. """ return (city or "").strip().title() def get_today_weather(city: str) -> TodayWeather: """ Get a mocked snapshot of today's weather for a city. Parameters ---------- city : str City name (already sanitized). Returns ------- TodayWeather Synthetic weather data used for demonstration/testing. """ return TodayWeather( city=city, country="ES", timezone="Europe/Madrid", tmaxC=30.0, tminC=18.0, precipitationMm=0.0, weatherText="Sunny", )

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/nevermined-io/weather-mcp-demo-py'

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