mcpField
W
weather

weather

github.com/chandima其他1184 次安装36 周前更新
代码仓库

关于 weather

Weather 是用于查询当前天气和预报的技能,主要调用 wttr.in,并以 Open-Meteo 提供 JSON 备用查询。适合无需 API 密钥的快速查询或程序化天气请求。

主要功能

  1. 01获取简洁的当前天气报告
  2. 02通过 wttr.in 查询完整预报
  3. 03选择公制或 USCS 单位
  4. 04通过 Open-Meteo 获取 JSON 天气数据
  5. 05使用城市名称或机场代码查询

适用场景

  1. 01查看指定地点的当前天气
  2. 02获取完整天气预报
  3. 03为脚本获取天气数据
  4. 04使用机场代码查询天气

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/chandima/agent-skills --skill weather

安装后在 Claude Code 中输入/weather确认已加载。

详细介绍

天气

两种免费服务,无需 API 密钥。

wttr.in(主要服务)

快速单行查询:

curl -s "wttr.in/London?format=3"
# Output: London: ⛅️ +8°C

精简格式:

curl -s "wttr.in/London?format=%l:+%c+%t+%h+%w"
# Output: London: ⛅️ +8°C 71% ↙5km/h

完整预报:

curl -s "wttr.in/London?T"

格式代码:%c 天气状况 · %t 温度 · %h 湿度 · %w 风速 · %l 位置 · %m 月相

提示:

  • 对空格进行 URL 编码:wttr.in/New+York
  • 机场代码:wttr.in/JFK
  • 单位:?m(公制)?u(USCS)
  • 仅今天:?1 · 仅当前:?0
  • PNG:curl -s "wttr.in/Berlin.png" -o /tmp/weather.png

Open-Meteo(备用,JSON)

免费、无需密钥,适合程序化使用:

curl -s "https://api.open-meteo.com/v1/forecast?latitude=51.5&longitude=-0.12&current_weather=true"

查找城市的坐标,然后进行查询。返回包含温度、风速和天气代码的 JSON。

文档:https://open-meteo.com/en/docs

评论

支持 Markdown