hkopenai.hk-climate-mcp-server 0.2.0__py3-none-any.whl → 0.4.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- hkopenai/hk_climate_mcp_server/__init__.py +3 -18
- hkopenai/hk_climate_mcp_server/__main__.py +1 -1
- hkopenai/hk_climate_mcp_server/server.py +247 -0
- hkopenai/hk_climate_mcp_server/tools/astronomical.py +109 -0
- hkopenai/hk_climate_mcp_server/tools/current_weather.py +106 -0
- hkopenai/hk_climate_mcp_server/tools/forecast.py +82 -0
- hkopenai/hk_climate_mcp_server/tools/lightning.py +20 -0
- hkopenai/hk_climate_mcp_server/tools/radiation.py +206 -0
- hkopenai/hk_climate_mcp_server/tools/temperature.py +119 -0
- hkopenai/hk_climate_mcp_server/tools/tides.py +165 -0
- hkopenai/hk_climate_mcp_server/tools/visibility.py +20 -0
- hkopenai/hk_climate_mcp_server/tools/warnings.py +77 -0
- {hkopenai_hk_climate_mcp_server-0.2.0.dist-info → hkopenai_hk_climate_mcp_server-0.4.0.dist-info}/METADATA +78 -6
- hkopenai_hk_climate_mcp_server-0.4.0.dist-info/RECORD +18 -0
- hkopenai/hk_climate_mcp_server/app.py +0 -65
- hkopenai/hk_climate_mcp_server/tool_weather.py +0 -241
- hkopenai_hk_climate_mcp_server-0.2.0.dist-info/RECORD +0 -10
- {hkopenai_hk_climate_mcp_server-0.2.0.dist-info → hkopenai_hk_climate_mcp_server-0.4.0.dist-info}/WHEEL +0 -0
- {hkopenai_hk_climate_mcp_server-0.2.0.dist-info → hkopenai_hk_climate_mcp_server-0.4.0.dist-info}/entry_points.txt +0 -0
- {hkopenai_hk_climate_mcp_server-0.2.0.dist-info → hkopenai_hk_climate_mcp_server-0.4.0.dist-info}/licenses/LICENSE +0 -0
- {hkopenai_hk_climate_mcp_server-0.2.0.dist-info → hkopenai_hk_climate_mcp_server-0.4.0.dist-info}/top_level.txt +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: hkopenai.hk_climate_mcp_server
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.4.0
|
4
4
|
Summary: Hong Kong Weather MCP Server providing climate and weather data tools
|
5
5
|
Author-email: Neo Chow <neo@01man.com>
|
6
6
|
License-Expression: MIT
|
@@ -16,7 +16,7 @@ Requires-Dist: pytest>=8.2.0
|
|
16
16
|
Requires-Dist: pytest-cov>=6.1.1
|
17
17
|
Dynamic: license-file
|
18
18
|
|
19
|
-
#
|
19
|
+
# HK Climate and Weather MCP Server
|
20
20
|
|
21
21
|
[](https://github.com/hkopenai/hk-climate-mcp-server)
|
22
22
|
[](https://opensource.org/licenses/MIT)
|
@@ -106,6 +106,77 @@ This is an MCP server that provides access to climate and weather data through a
|
|
106
106
|
- specialWeatherTips: List of special weather tips
|
107
107
|
- updateTime: Last update time
|
108
108
|
|
109
|
+
### Visibility Data
|
110
|
+
`get_visibility_data(lang: str = "en") -> Dict`
|
111
|
+
- Get latest 10-minute mean visibility data for Hong Kong
|
112
|
+
- Parameters:
|
113
|
+
- lang: Language code (en/tc/sc, default: en)
|
114
|
+
- Returns:
|
115
|
+
- Dict containing visibility data with fields and data arrays
|
116
|
+
|
117
|
+
### Lightning Data
|
118
|
+
`get_lightning_data(lang: str = "en") -> Dict`
|
119
|
+
- Get cloud-to-ground and cloud-to-cloud lightning count data
|
120
|
+
- Parameters:
|
121
|
+
- lang: Language code (en/tc/sc, default: en)
|
122
|
+
- Returns:
|
123
|
+
- Dict containing lightning data with fields and data arrays
|
124
|
+
|
125
|
+
### Moon Times
|
126
|
+
`get_moon_times(year: int, month: Optional[int] = None, day: Optional[int] = None, lang: str = "en") -> Dict`
|
127
|
+
- Get times of moonrise, moon transit and moonset
|
128
|
+
- Parameters:
|
129
|
+
- year: Year (2018-2024)
|
130
|
+
- month: Optional month (1-12)
|
131
|
+
- day: Optional day (1-31)
|
132
|
+
- lang: Language code (en/tc/sc, default: en)
|
133
|
+
- Returns:
|
134
|
+
- Dict containing moon times data with fields and data arrays
|
135
|
+
|
136
|
+
### Hourly Tides
|
137
|
+
`get_hourly_tides(station: str, year: int, month: Optional[int] = None, day: Optional[int] = None, hour: Optional[int] = None, lang: str = "en") -> Dict`
|
138
|
+
- Get hourly heights of astronomical tides for a specific station
|
139
|
+
- Parameters:
|
140
|
+
- station: Station code (e.g. 'CCH' for Cheung Chau)
|
141
|
+
- year: Year (2022-2024)
|
142
|
+
- month: Optional month (1-12)
|
143
|
+
- day: Optional day (1-31)
|
144
|
+
- hour: Optional hour (1-24)
|
145
|
+
- lang: Language code (en/tc/sc, default: en)
|
146
|
+
- Returns:
|
147
|
+
- Dict containing tide data with fields and data arrays
|
148
|
+
|
149
|
+
### High/Low Tides
|
150
|
+
`get_high_low_tides(station: str, year: int, month: Optional[int] = None, day: Optional[int] = None, hour: Optional[int] = None, lang: str = "en") -> Dict`
|
151
|
+
- Get times and heights of astronomical high and low tides
|
152
|
+
- Parameters:
|
153
|
+
- station: Station code (e.g. 'CCH' for Cheung Chau)
|
154
|
+
- year: Year (2022-2024)
|
155
|
+
- month: Optional month (1-12)
|
156
|
+
- day: Optional day (1-31)
|
157
|
+
- hour: Optional hour (1-24)
|
158
|
+
- lang: Language code (en/tc/sc, default: en)
|
159
|
+
- Returns:
|
160
|
+
- Dict containing tide data with fields and data arrays
|
161
|
+
|
162
|
+
### Weather and Radiation Report
|
163
|
+
`get_weather_radiation_report(date: str, station: str, lang: str = "en") -> Dict`
|
164
|
+
- Get weather and radiation level report for Hong Kong
|
165
|
+
- Parameters:
|
166
|
+
- date: Mandatory date in YYYYMMDD format (e.g., 20250618)
|
167
|
+
- station: Mandatory station code (e.g., 'HKO' for Hong Kong Observatory)
|
168
|
+
- lang: Language code (en/tc/sc, default: en)
|
169
|
+
- Returns:
|
170
|
+
- Dict containing weather and radiation data or error message if parameters are invalid
|
171
|
+
|
172
|
+
### Station Codes
|
173
|
+
`get_radiation_station_codes() -> Dict`
|
174
|
+
- Get a list of station codes and their corresponding names for weather and radiation reports in Hong Kong
|
175
|
+
- Parameters:
|
176
|
+
- None
|
177
|
+
- Returns:
|
178
|
+
- Dict mapping station codes to station names
|
179
|
+
|
109
180
|
## Setup
|
110
181
|
|
111
182
|
1. Clone this repository
|
@@ -115,13 +186,13 @@ This is an MCP server that provides access to climate and weather data through a
|
|
115
186
|
```
|
116
187
|
3. Run the server:
|
117
188
|
```bash
|
118
|
-
python
|
189
|
+
python server.py
|
119
190
|
```
|
120
191
|
|
121
192
|
### Running Options
|
122
193
|
|
123
|
-
- Default stdio mode: `python
|
124
|
-
- SSE mode (port 8000): `python
|
194
|
+
- Default stdio mode: `python server.py`
|
195
|
+
- SSE mode (port 8000): `python server.py --sse`
|
125
196
|
|
126
197
|
## Cline Integration
|
127
198
|
|
@@ -136,7 +207,8 @@ To connect this MCP server to Cline using stdio:
|
|
136
207
|
"type": "stdio",
|
137
208
|
"command": "python",
|
138
209
|
"args": [
|
139
|
-
"
|
210
|
+
"-m",
|
211
|
+
"hkopenai.hk_climate_mcp_server"
|
140
212
|
]
|
141
213
|
}
|
142
214
|
}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
hkopenai/hk_climate_mcp_server/__init__.py,sha256=DDVTAriSgigX8xSy17OE0w3Wv05yuiD4EdJixt6eNLw,112
|
2
|
+
hkopenai/hk_climate_mcp_server/__main__.py,sha256=bIsnXlqwCtkerzB-j-IVGQR1zFNgZmeFxi3ww3AXe3Q,94
|
3
|
+
hkopenai/hk_climate_mcp_server/server.py,sha256=ftkqYWopE2EgKLEG4JjPyKl4Okhhy2hBauCu6hzJI3I,8307
|
4
|
+
hkopenai/hk_climate_mcp_server/tools/astronomical.py,sha256=hkrXihSdNfaY14kY9ePQsbiAfO8tQzONjkLfJUgk5CA,2990
|
5
|
+
hkopenai/hk_climate_mcp_server/tools/current_weather.py,sha256=iywirobmBHPAK2b3u9UChQSafuIcpoFPTUorRSbpAS4,3613
|
6
|
+
hkopenai/hk_climate_mcp_server/tools/forecast.py,sha256=wwxM5SSbZ_zFBkY2kbp2ehWd7c_hD6spAsz3aYHZmUw,3035
|
7
|
+
hkopenai/hk_climate_mcp_server/tools/lightning.py,sha256=eSiObmsMuKKakJT1fkg7e0B_Bwie0hSV_9ggegm497U,671
|
8
|
+
hkopenai/hk_climate_mcp_server/tools/radiation.py,sha256=EkCqKPpJVrOusm2BoQrfP1onq6Sl9XSSP0rnKcQRZjg,6529
|
9
|
+
hkopenai/hk_climate_mcp_server/tools/temperature.py,sha256=FiHCnq7OBsUNrpbDTKEfK3HyO6euKJ5Io9bciYhe2XM,3809
|
10
|
+
hkopenai/hk_climate_mcp_server/tools/tides.py,sha256=qpiYkulyEnnKzXZiZLIPtk2wDn3uKs_UpKyb8XXO23I,5089
|
11
|
+
hkopenai/hk_climate_mcp_server/tools/visibility.py,sha256=CHfLcuH6HKix6_7395ado-VppNFPlTYHABLtdXmIzV4,668
|
12
|
+
hkopenai/hk_climate_mcp_server/tools/warnings.py,sha256=XjJW25CjiAuJTmzssLDkp4oNcCIke4vbOYTaVH93EOc,2446
|
13
|
+
hkopenai_hk_climate_mcp_server-0.4.0.dist-info/licenses/LICENSE,sha256=RzryYGol65qd1yszjiy-hSUsX9EJJkpwEpNXnIs_Bv8,1070
|
14
|
+
hkopenai_hk_climate_mcp_server-0.4.0.dist-info/METADATA,sha256=pBkI1stOW_CC-YERrc8lFpsVvyWdqAw6jTUg35M0g4o,7173
|
15
|
+
hkopenai_hk_climate_mcp_server-0.4.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
16
|
+
hkopenai_hk_climate_mcp_server-0.4.0.dist-info/entry_points.txt,sha256=2pPEyDw5KdrNNZIGQsSrY-5IRMgWaWvEQT_BQJhKPMQ,82
|
17
|
+
hkopenai_hk_climate_mcp_server-0.4.0.dist-info/top_level.txt,sha256=6PRVKRM9BiU5vzKKGnsq2t0-Bi0TrJvSY35llo4nLFA,9
|
18
|
+
hkopenai_hk_climate_mcp_server-0.4.0.dist-info/RECORD,,
|
@@ -1,65 +0,0 @@
|
|
1
|
-
import argparse
|
2
|
-
from fastmcp import FastMCP
|
3
|
-
from hkopenai.hk_climate_mcp_server import tool_weather
|
4
|
-
from typing import Dict, Annotated, Optional
|
5
|
-
from pydantic import Field
|
6
|
-
|
7
|
-
def create_mcp_server():
|
8
|
-
"""Create and configure the HKO MCP server"""
|
9
|
-
mcp = FastMCP(name="HKOServer")
|
10
|
-
|
11
|
-
@mcp.tool(
|
12
|
-
description="Get current weather observations, warnings, temperature, humidity and rainfall in Hong Kong from Hong Kong Observatory, with optional region or place in Hong Kong",
|
13
|
-
)
|
14
|
-
def get_current_weather(region: str = "Hong Kong Observatory") -> Dict:
|
15
|
-
return tool_weather.get_current_weather(region)
|
16
|
-
|
17
|
-
@mcp.tool(
|
18
|
-
description="Get the 9-day weather forecast for Hong Kong including general situation, daily forecasts, sea and soil temperatures",
|
19
|
-
)
|
20
|
-
def get_9_day_weather_forecast(lang: str = "en") -> Dict:
|
21
|
-
return tool_weather.get_9_day_weather_forecast(lang)
|
22
|
-
|
23
|
-
@mcp.tool(
|
24
|
-
description="Get local weather forecast for Hong Kong including forecast description, outlook and update time",
|
25
|
-
)
|
26
|
-
def get_local_weather_forecast(lang: str = "en") -> Dict:
|
27
|
-
return tool_weather.get_local_weather_forecast(lang)
|
28
|
-
|
29
|
-
@mcp.tool(
|
30
|
-
description="Get weather warning summary for Hong Kong including warning messages and update time",
|
31
|
-
)
|
32
|
-
def get_weather_warning_summary(lang: str = "en") -> Dict:
|
33
|
-
return tool_weather.get_weather_warning_summary(lang)
|
34
|
-
|
35
|
-
@mcp.tool(
|
36
|
-
description="Get detailed weather warning information for Hong Kong including warning statement and update time",
|
37
|
-
)
|
38
|
-
def get_weather_warning_info(lang: str = "en") -> Dict:
|
39
|
-
return tool_weather.get_weather_warning_info(lang)
|
40
|
-
|
41
|
-
@mcp.tool(
|
42
|
-
description="Get special weather tips for Hong Kong including tips list and update time",
|
43
|
-
)
|
44
|
-
def get_special_weather_tips(lang: str = "en") -> Dict:
|
45
|
-
return tool_weather.get_special_weather_tips(lang)
|
46
|
-
|
47
|
-
return mcp
|
48
|
-
|
49
|
-
def main():
|
50
|
-
parser = argparse.ArgumentParser(description='HKO MCP Server')
|
51
|
-
parser.add_argument('-s', '--sse', action='store_true',
|
52
|
-
help='Run in SSE mode instead of stdio')
|
53
|
-
args = parser.parse_args()
|
54
|
-
|
55
|
-
server = create_mcp_server()
|
56
|
-
|
57
|
-
if args.sse:
|
58
|
-
server.run(transport="streamable-http")
|
59
|
-
print("HKO MCP Server running in SSE mode on port 8000")
|
60
|
-
else:
|
61
|
-
server.run()
|
62
|
-
print("HKO MCP Server running in stdio mode")
|
63
|
-
|
64
|
-
if __name__ == "__main__":
|
65
|
-
main()
|
@@ -1,241 +0,0 @@
|
|
1
|
-
import requests
|
2
|
-
from typing import Dict, List, Any
|
3
|
-
|
4
|
-
def get_current_weather(region: str = "Hong Kong Observatory", lang: str = "en") -> Dict:
|
5
|
-
"""
|
6
|
-
Get current weather observations for a specific region in Hong Kong
|
7
|
-
|
8
|
-
Args:
|
9
|
-
region: The region to get weather for (default: "Hong Kong Observatory")
|
10
|
-
lang: Language code (en/tc/sc, default: en)
|
11
|
-
|
12
|
-
Returns:
|
13
|
-
Dict containing:
|
14
|
-
- warning: Current weather warnings
|
15
|
-
- temperature: Current temperature in Celsius
|
16
|
-
- humidity: Current humidity percentage
|
17
|
-
- rainfall: Current rainfall in mm
|
18
|
-
"""
|
19
|
-
response = requests.get(
|
20
|
-
f"https://data.weather.gov.hk/weatherAPI/opendata/weather.php?dataType=rhrread&lang={lang}"
|
21
|
-
)
|
22
|
-
data = response.json()
|
23
|
-
|
24
|
-
# Handle warnings
|
25
|
-
warning = "No warning in force"
|
26
|
-
if "warningMessage" in data:
|
27
|
-
if isinstance(data["warningMessage"], list) and data["warningMessage"]:
|
28
|
-
warning = data["warningMessage"][0]
|
29
|
-
elif data["warningMessage"]: # Handle string case
|
30
|
-
warning = data["warningMessage"]
|
31
|
-
|
32
|
-
# Get default values from HKO data
|
33
|
-
default_temp = next(
|
34
|
-
(
|
35
|
-
t
|
36
|
-
for t in data.get("temperature", {}).get("data", [])
|
37
|
-
if t.get("place") == "Hong Kong Observatory"
|
38
|
-
),
|
39
|
-
{"value": 25, "unit": "C", "recordTime": ""},
|
40
|
-
)
|
41
|
-
default_humidity = next(
|
42
|
-
(
|
43
|
-
h
|
44
|
-
for h in data.get("humidity", {}).get("data", [])
|
45
|
-
if h.get("place") == "Hong Kong Observatory"
|
46
|
-
),
|
47
|
-
{"value": 60, "unit": "percent", "recordTime": ""},
|
48
|
-
)
|
49
|
-
# Find matching region temperature
|
50
|
-
temp_data = data.get("temperature", {}).get("data", [])
|
51
|
-
matched_temp = next(
|
52
|
-
(t for t in temp_data if t["place"].lower() == region.lower()),
|
53
|
-
{
|
54
|
-
"place": "Hong Kong Observatory",
|
55
|
-
"value": default_temp["value"],
|
56
|
-
"unit": default_temp["unit"],
|
57
|
-
},
|
58
|
-
)
|
59
|
-
matched_temp["recordTime"] = data["temperature"]["recordTime"]
|
60
|
-
|
61
|
-
# Get humidity
|
62
|
-
humidity = next(
|
63
|
-
(
|
64
|
-
h
|
65
|
-
for h in data.get("humidity", {}).get("data", [])
|
66
|
-
if h.get("place") == matched_temp["place"]
|
67
|
-
),
|
68
|
-
default_humidity,
|
69
|
-
)
|
70
|
-
humidity["recordTime"] = data["humidity"]["recordTime"]
|
71
|
-
|
72
|
-
# Get rainfall (0 if no rain)
|
73
|
-
rainfall = 0
|
74
|
-
if "rainfall" in data:
|
75
|
-
rainfall = max(float(r.get("max", 0)) for r in data["rainfall"]["data"])
|
76
|
-
rainfall_start = data["rainfall"]["startTime"]
|
77
|
-
rainfall_end = data["rainfall"]["endTime"]
|
78
|
-
|
79
|
-
return {
|
80
|
-
"generalSituation": warning,
|
81
|
-
"weatherObservation": {
|
82
|
-
"temperature": {
|
83
|
-
"value": matched_temp["value"],
|
84
|
-
"unit": matched_temp["unit"],
|
85
|
-
"recordTime": matched_temp["recordTime"],
|
86
|
-
"place": matched_temp["place"]
|
87
|
-
},
|
88
|
-
"humidity": {
|
89
|
-
"value": humidity["value"],
|
90
|
-
"unit": humidity["unit"],
|
91
|
-
"recordTime": humidity["recordTime"],
|
92
|
-
"place": matched_temp["place"]
|
93
|
-
},
|
94
|
-
"rainfall": {
|
95
|
-
"value": rainfall,
|
96
|
-
"min": min(float(r.get("min", 0)) for r in data["rainfall"]["data"]),
|
97
|
-
"unit": "mm",
|
98
|
-
"startTime": rainfall_start,
|
99
|
-
"endTime": rainfall_end
|
100
|
-
},
|
101
|
-
"uvindex": data.get("uvindex", {})
|
102
|
-
},
|
103
|
-
"updateTime": data["updateTime"],
|
104
|
-
"icon": data.get("icon", []),
|
105
|
-
"iconUpdateTime": data.get("iconUpdateTime", "")
|
106
|
-
}
|
107
|
-
|
108
|
-
def get_9_day_weather_forecast(lang: str = "en") -> Dict[str, Any]:
|
109
|
-
"""
|
110
|
-
Get the 9-day weather forecast for Hong Kong.
|
111
|
-
|
112
|
-
Args:
|
113
|
-
lang: Language code (en/tc/sc, default: en)
|
114
|
-
|
115
|
-
Returns:
|
116
|
-
Dict containing:
|
117
|
-
- generalSituation: General weather situation
|
118
|
-
- weatherForecast: List of daily forecast dicts (date, week, wind, weather, temp/humidity, etc.)
|
119
|
-
- updateTime: Last update time
|
120
|
-
- seaTemp: Sea temperature info
|
121
|
-
- soilTemp: List of soil temperature info
|
122
|
-
"""
|
123
|
-
url = f"https://data.weather.gov.hk/weatherAPI/opendata/weather.php?dataType=fnd&lang={lang}"
|
124
|
-
response = requests.get(url)
|
125
|
-
data = response.json()
|
126
|
-
|
127
|
-
# Structure the output
|
128
|
-
forecast = {
|
129
|
-
"generalSituation": data.get("generalSituation", ""),
|
130
|
-
"weatherForecast": [],
|
131
|
-
"updateTime": data.get("updateTime", ""),
|
132
|
-
"seaTemp": data.get("seaTemp", {}),
|
133
|
-
"soilTemp": data.get("soilTemp", []),
|
134
|
-
}
|
135
|
-
|
136
|
-
# Extract 9-day forecast
|
137
|
-
for day in data.get("weatherForecast", []):
|
138
|
-
forecast["weatherForecast"].append({
|
139
|
-
"forecastDate": day.get("forecastDate", ""),
|
140
|
-
"week": day.get("week", ""),
|
141
|
-
"forecastWind": day.get("forecastWind", ""),
|
142
|
-
"forecastWeather": day.get("forecastWeather", ""),
|
143
|
-
"forecastMaxtemp": day.get("forecastMaxtemp", {}),
|
144
|
-
"forecastMintemp": day.get("forecastMintemp", {}),
|
145
|
-
"forecastMaxrh": day.get("forecastMaxrh", {}),
|
146
|
-
"forecastMinrh": day.get("forecastMinrh", {}),
|
147
|
-
"ForecastIcon": day.get("ForecastIcon", ""),
|
148
|
-
"PSR": day.get("PSR", ""),
|
149
|
-
})
|
150
|
-
return forecast
|
151
|
-
|
152
|
-
def get_local_weather_forecast(lang: str = "en") -> Dict[str, Any]:
|
153
|
-
"""
|
154
|
-
Get local weather forecast for Hong Kong.
|
155
|
-
|
156
|
-
Args:
|
157
|
-
lang: Language code (en/tc/sc, default: en)
|
158
|
-
|
159
|
-
Returns:
|
160
|
-
Dict containing:
|
161
|
-
- forecastDesc: Forecast description
|
162
|
-
- outlook: Outlook forecast
|
163
|
-
- updateTime: Last update time
|
164
|
-
- forecastPeriod: Forecast period
|
165
|
-
- forecastDate: Forecast date
|
166
|
-
"""
|
167
|
-
url = f"https://data.weather.gov.hk/weatherAPI/opendata/weather.php?dataType=flw&lang={lang}"
|
168
|
-
response = requests.get(url)
|
169
|
-
data = response.json()
|
170
|
-
|
171
|
-
return {
|
172
|
-
"generalSituation": data.get("generalSituation", ""),
|
173
|
-
"forecastDesc": data.get("forecastDesc", ""),
|
174
|
-
"outlook": data.get("outlook", ""),
|
175
|
-
"updateTime": data.get("updateTime", ""),
|
176
|
-
"forecastPeriod": data.get("forecastPeriod", ""),
|
177
|
-
"forecastDate": data.get("forecastDate", ""),
|
178
|
-
}
|
179
|
-
|
180
|
-
def get_weather_warning_summary(lang: str = "en") -> Dict[str, Any]:
|
181
|
-
"""
|
182
|
-
Get weather warning summary for Hong Kong.
|
183
|
-
|
184
|
-
Args:
|
185
|
-
lang: Language code (en/tc/sc, default: en)
|
186
|
-
|
187
|
-
Returns:
|
188
|
-
Dict containing:
|
189
|
-
- warningMessage: List of warning messages
|
190
|
-
- updateTime: Last update time
|
191
|
-
"""
|
192
|
-
url = f"https://data.weather.gov.hk/weatherAPI/opendata/weather.php?dataType=warnsum&lang={lang}"
|
193
|
-
response = requests.get(url)
|
194
|
-
data = response.json()
|
195
|
-
|
196
|
-
return {
|
197
|
-
"warningMessage": data.get("warningMessage", []),
|
198
|
-
"updateTime": data.get("updateTime", ""),
|
199
|
-
}
|
200
|
-
|
201
|
-
def get_weather_warning_info(lang: str = "en") -> Dict[str, Any]:
|
202
|
-
"""
|
203
|
-
Get detailed weather warning information for Hong Kong.
|
204
|
-
|
205
|
-
Args:
|
206
|
-
lang: Language code (en/tc/sc, default: en)
|
207
|
-
|
208
|
-
Returns:
|
209
|
-
Dict containing:
|
210
|
-
- warningStatement: Warning statement
|
211
|
-
- updateTime: Last update time
|
212
|
-
"""
|
213
|
-
url = f"https://data.weather.gov.hk/weatherAPI/opendata/weather.php?dataType=warningInfo&lang={lang}"
|
214
|
-
response = requests.get(url)
|
215
|
-
data = response.json()
|
216
|
-
|
217
|
-
return {
|
218
|
-
"warningStatement": data.get("warningStatement", ""),
|
219
|
-
"updateTime": data.get("updateTime", ""),
|
220
|
-
}
|
221
|
-
|
222
|
-
def get_special_weather_tips(lang: str = "en") -> Dict[str, Any]:
|
223
|
-
"""
|
224
|
-
Get special weather tips for Hong Kong.
|
225
|
-
|
226
|
-
Args:
|
227
|
-
lang: Language code (en/tc/sc, default: en)
|
228
|
-
|
229
|
-
Returns:
|
230
|
-
Dict containing:
|
231
|
-
- specialWeatherTips: List of special weather tips
|
232
|
-
- updateTime: Last update time
|
233
|
-
"""
|
234
|
-
url = f"https://data.weather.gov.hk/weatherAPI/opendata/weather.php?dataType=swt&lang={lang}"
|
235
|
-
response = requests.get(url)
|
236
|
-
data = response.json()
|
237
|
-
|
238
|
-
return {
|
239
|
-
"specialWeatherTips": data.get("specialWeatherTips", []),
|
240
|
-
"updateTime": data.get("updateTime", ""),
|
241
|
-
}
|
@@ -1,10 +0,0 @@
|
|
1
|
-
hkopenai/hk_climate_mcp_server/__init__.py,sha256=QgSoOyNq_fnuED4FMOV9aj2ZDyEmezGRy2GCP427G5g,519
|
2
|
-
hkopenai/hk_climate_mcp_server/__main__.py,sha256=2rpUSwIvU59qepKyDNMz6AtDrbsRVVIZZP0hL5LoZbs,91
|
3
|
-
hkopenai/hk_climate_mcp_server/app.py,sha256=sTJS-eEBwyZz4KiGSEJ5QVzhiBNAGvUPAukhYNlkiEk,2479
|
4
|
-
hkopenai/hk_climate_mcp_server/tool_weather.py,sha256=MitwPrgdE08zszoIqezY-Cxo5Z5fN5HHiZ6T-IpP3N0,8180
|
5
|
-
hkopenai_hk_climate_mcp_server-0.2.0.dist-info/licenses/LICENSE,sha256=RzryYGol65qd1yszjiy-hSUsX9EJJkpwEpNXnIs_Bv8,1070
|
6
|
-
hkopenai_hk_climate_mcp_server-0.2.0.dist-info/METADATA,sha256=CQb8Er_uk1Ms9ZQEKfS7l7ytdBo_K06yWrV9d6t-7zI,4415
|
7
|
-
hkopenai_hk_climate_mcp_server-0.2.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
8
|
-
hkopenai_hk_climate_mcp_server-0.2.0.dist-info/entry_points.txt,sha256=2pPEyDw5KdrNNZIGQsSrY-5IRMgWaWvEQT_BQJhKPMQ,82
|
9
|
-
hkopenai_hk_climate_mcp_server-0.2.0.dist-info/top_level.txt,sha256=6PRVKRM9BiU5vzKKGnsq2t0-Bi0TrJvSY35llo4nLFA,9
|
10
|
-
hkopenai_hk_climate_mcp_server-0.2.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|