命令概述
openclaw plugins 命令用于管理 OpenClaw 的插件生态。插件可以为 AI 助手添加新的工具、技能和集成能力。
查看已安装插件
openclaw plugins list
Installed Plugins:
Name Version Status Description
──────────────────────────────────────────────────────
web-search 1.2.0 Active Web search capability
code-exec 1.0.3 Active Code execution sandbox
image-gen 2.1.0 Active AI image generation
weather 1.0.0 Inactive Weather information
rss-reader 1.1.0 Active RSS feed reader
Total: 5 plugins (4 active)
搜索插件
openclaw plugins search weather
Available Plugins:
weather 1.0.0 Weather information from multiple providers
weather-pro 2.0.0 Advanced weather with forecasts and maps
weather-alert 1.0.0 Severe weather alerts and notifications
安装插件
# 从官方仓库安装
openclaw plugins install weather
# 安装特定版本
openclaw plugins install [email protected]
# 从 GitHub 安装
openclaw plugins install github:username/openclaw-plugin-name
# 从本地路径安装
openclaw plugins install /path/to/plugin
配置插件
安装后配置插件参数:
openclaw plugins configure weather
Configuring plugin: weather
API Provider:
[1] OpenWeatherMap (free tier available)
[2] WeatherAPI
[3] AccuWeather
> 1
Enter OpenWeatherMap API key: ****
Default units:
[1] Metric (°C, km/h)
[2] Imperial (°F, mph)
> 1
Plugin 'weather' configured successfully.
或直接在配置文件中设置:
{
"plugins": {
"weather": {
"provider": "openweathermap",
"apiKey": "{{WEATHER_API_KEY}}",
"units": "metric",
"defaultCity": "北京"
}
}
}
启用/禁用插件
openclaw plugins enable weather
openclaw plugins disable weather
更新插件
# 更新特定插件
openclaw plugins update weather
# 更新所有插件
openclaw plugins update --all
# 检查可用更新
openclaw plugins outdated
卸载插件
openclaw plugins uninstall weather
查看插件详情
openclaw plugins info weather
Plugin: weather
Version: 1.0.0
Author: OpenClaw Community
License: MIT
Description: Weather information from multiple providers
Provides tools:
get_weather - Get current weather for a location
get_forecast - Get weather forecast
Configuration:
provider - Weather data provider
apiKey - API key for the provider
units - Temperature units (metric/imperial)
Dependencies: none
Size: 45KB
将插件分配给频道
# 为频道添加插件工具
openclaw channels set telegram-main --add-tool weather.get_weather
openclaw channels set telegram-main --add-tool weather.get_forecast
或在配置中设置:
{
"channels": {
"telegram-main": {
"tools": ["weather.get_weather", "weather.get_forecast", "web_search"]
}
}
}
开发自定义插件
创建插件脚手架:
openclaw plugins create my-plugin
生成的目录结构:
my-plugin/
├── package.json
├── index.js
├── tools/
│ └── my-tool.js
├── config.schema.json
└── README.md
插件入口文件示例:
// index.js
module.exports = {
name: 'my-plugin',
version: '1.0.0',
tools: [
{
name: 'my_tool',
description: '我的自定义工具',
parameters: {
type: 'object',
properties: {
query: { type: 'string', description: '查询内容' }
},
required: ['query']
},
execute: async ({ query }) => {
return { result: `处理: ${query}` };
}
}
]
};
测试开发中的插件:
openclaw plugins test /path/to/my-plugin
插件市场
浏览官方插件市场:
openclaw plugins market
openclaw plugins market --category tools
openclaw plugins market --sort popular
总结
OpenClaw 的插件系统通过模块化设计让 AI 助手的能力可以灵活扩展。无论是使用社区插件还是开发自定义插件,都能轻松地为 AI 添加新技能。