get_weather
Retrieve weather data for a specified city using a Python MCP server, enabling integration with applications like Claude Desktop or Cursor for context-aware weather queries.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| city | Yes |
Implementation Reference
- mcp_server.py:17-20 (handler)The get_weather tool handler, decorated with @mcp.tool(), fetches the weather for a given city from the wttr.in API and returns a formatted string.@mcp.tool() async def get_weather(city: str) -> str: response = httpx.get(f"https://wttr.in/{city}?format=3") return response.text
- mcp_server.py:17-17 (registration)Registration of the get_weather tool using the @mcp.tool() decorator.@mcp.tool()
- mcp_server.py:18-18 (schema)Input schema: city (str), Output: str (weather info).async def get_weather(city: str) -> str: