QwenPaw工具注册
## 工具插件是如何工作的 ### 插件的 type 字段决定了能力 在 plugin.json 中把 type 设为 tool插件安装后会自动把工具注册给 Agent 调用 json { id: my-custom-tool, name: 我的自定义工具, version: 1.0.0, type: tool, entry: { backend: plugin.py } } ### 注册方式 QwenPaw 提供了两种注册工具的方式 **方式一通过 tool_descriptor 装饰器v2.0.1 推荐** python from qwenpaw.tools import tool_descriptor tool_descriptor( nameget_weather, description查询指定城市的天气 ) def get_weather(city: str) - str: return f{city}晴25°C 工具会自动被发现和注册不需要手动调用 register_tool。 **方式二通过 PluginApi.register_tool** python from qwenpaw.plugins.api import PluginApi class MyToolPlugin: def register(self, api: PluginApi): api.register_tool(get_weather) 完整例子一个天气工具插件weather-tool/ ├── plugin.json ├── plugin.pyplugin.json{ id: weather-tool, name: 天气查询工具, version: 1.0.0, type: tool, description: 查询城市天气, author: 同事, entry: { backend: plugin.py } }plugin.pyfrom qwenpaw.tools import tool_descriptor tool_descriptor( nameget_weather, description根据城市名查询当前天气返回温度、天气状况 ) def get_weather(city: str) - str: # 这里可以接真实的天气 API return f{city}晴22-30°C微风安装qwenpaw plugin install weather-tool/安装后重启 QwenPaw进入Agent 设置 → 工具管理就能看到get_weather工具启用后 Agent 就可以调用了。安装后工具的生命周期上传插件 ZIP/目录 ↓ qwenpaw plugin install ← 安装到本地 ↓ qwenpaw app 启动 ← 自动加载、自动注册工具 ↓ Console → Agent 设置 → 工具管理 ← 启用/禁用/配置 API Key ↓ Agent 对话中就可以调用 ← LLM 自主决定何时调用所以回到你的问题是的插件上传接口完全可以上传工具。你同事给你的插件如果type是tool那就是两个 Agent 工具。你只需要# QwenPaw 离线状态下 qwenpaw plugin install /path/to/plugin-dir/ # 然后启动 qwenpaw app工具就会出现在工具管理里了。把插件文件给我看看plugin.json我帮你确认是不是工具类插件