Skip to main content
Glama
juhemcp

Juhe Weather MCP Server

Official
by juhemcp

query_weather

Retrieve real-time weather forecasts for cities, regions, and counties across China by providing the location name. Enables accurate weather updates for specific areas.

Instructions

根据城市、地区、区县名称查询当地实时天气预报情况

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cityYes查询的城市名称,如北京、上海、广州、深圳、泰顺等;城市或区县或地区名使用简写,严格按照规范填写,否则会导致查询失败

Implementation Reference

  • Full implementation of the query_weather tool, including decorator registration, input schema, and execution logic using JUHE Weather API.
    @mcp.tool(name="query_weather", description="根据城市、地区、区县名称查询当地实时天气预报情况") async def query_weather( city: str = Field(description="查询的城市名称,如北京、上海、广州、深圳、泰顺等;城市或区县或地区名使用简写,严格按照规范填写,否则会导致查询失败") ) -> list[types.TextContent | types.ImageContent | types.EmbeddedResource]: """根据城市、地区、区县名称查询当地实时天气预报情况""" url = f"{JUHE_WEATHER_API_BASE}/query" params = { "city": city, "key": JUHE_WEATHER_API_KEY } async with httpx.AsyncClient() as client: response = await client.post(url, params=params) data = response.json() if data["error_code"] == 0: result = data["result"] return [ types.TextContent( type="text", text=f"{result}" ) ] else: return [ types.TextContent( type="text", text=f"Error: {data['reason']}" ) ]

Other Tools

Related 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/juhemcp/jweather-mcp-server'

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