get_weather
Retrieve current weather data for any specified city using this Python MCP server tool.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| city | Yes |
Implementation Reference
- mcp_server.py:17-17 (registration)Decorator that registers the get_weather function as a tool in the MCP server.@mcp.tool()
- mcp_server.py:18-20 (handler)The main handler function implementing the get_weather tool logic by querying the wttr.in API for the specified city.async def get_weather(city: str) -> str: response = httpx.get(f"https://wttr.in/{city}?format=3") return response.text
- mcp_server.py:18-18 (schema)Type hints define the input schema (city: str) and output (str).async def get_weather(city: str) -> str: