SKILL.md
readonlyread-only
name
weather
description
使用 web_fetch 取得目前天氣與預報,若無法使用則改用 wttr.in curl 查詢地點、降雨、溫度、旅遊規劃。
天氣
用於查詢目前天氣、降雨/溫度檢查、預報及旅遊規劃。需要提供城市、地區、機場代碼或經緯度座標。
優先使用:web_fetch
當工具可用時,優先使用 web_fetch。要求 JSON 格式,因為 wttr.in 在收到瀏覽器類型的 User-Agent 時,會回傳瀏覽器導向的 HTML。
await web_fetch({
url: "https://wttr.in/London?format=j2",
extractMode: "text",
maxChars: 12000,
});
若要簡短回答,請摘要 current_condition[0]、nearest_area[0] 以及 weather[] 中的前幾筆資料。一般摘要使用 format=j2,因為它省略了龐大的每小時資料,且符合預設的 web_fetch 輸出上限。有用的 JSON 欄位:
current_condition[0].weatherDesc[0].value:天氣狀況current_condition[0].temp_C/temp_F:溫度current_condition[0].FeelsLikeC/FeelsLikeF:體感溫度current_condition[0].precipMM:降雨量current_condition[0].humidity:濕度current_condition[0].windspeedKmph/windspeedMiles:風速weather[].date、maxtempC、mintempC:預報
備用方案:curl
僅在 web_fetch 不可用或停用時使用 curl。建議使用 HTTPS 並將 URL 加上引號。
curl --fail --silent --show-error --max-time 20 "https://wttr.in/London?format=j1"
curl --fail --silent --show-error --max-time 20 "https://wttr.in/London?format=3"
curl --fail --silent --show-error --max-time 20 "https://wttr.in/London?0"
curl --fail --silent --show-error --max-time 20 "https://wttr.in/London?format=v2"
curl --fail --silent --show-error --max-time 20 "https://wttr.in/New+York?format=3"
有用的格式代碼:
%l:地點%c:天氣圖示%t:溫度%f:體感溫度%w:風%h:濕度%p:降雨量
curl --fail --silent --show-error --max-time 20 "https://wttr.in/London?format=%l:+%c+%t,+feels+%f,+rain+%p,+wind+%w"






