mcpField
W
weather

weather

github.com/volcengine其他41.1k142 次安装今天更新
代码仓库

关于 weather

一项通过 wttr.in 获取当前天气和预报的技能,并以 Open-Meteo 作为 JSON 备用服务。两项服务均免费且无需 API 密钥。

主要功能

  1. 01获取当前天气和预报
  2. 02选择简洁或详细输出
  3. 03设置公制或 USCS 单位
  4. 04查询 Open-Meteo JSON 数据
  5. 05使用城市名或机场代码

适用场景

  1. 01查看指定地点的当前天气
  2. 02查阅完整天气预报
  3. 03以程序方式获取天气数据
  4. 04通过机场代码查询天气

安装

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

$npx skills add https://github.com/volcengine/openviking --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(美制)
  • 仅今天:?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