We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/tanghui886/MCP_WEATHER'
If you have feedback or need assistance with the MCP directory API, please join our Discord server
get_weather.py•533 B
from spider.get_city_list import get_city_list
from spider.get_weather_by_cityId import get_weather_by_cityId
def get_weather(input_str:str)->str:
# 清洗输入:去除"市"、"区",分割城市和区
city,district=input_str.replace("市","").replace("区","").split()
data = get_city_list()
result=[item for item in data
if item['city_cn'] == city
and item['district_cn'] == district]
if result:
return get_weather_by_cityId(result[0]['city_id'])
else:
return ''