Tool Registry OpenClaw Skill
工具注册与发现系统。基于Token匹配的工具路由,支持权限控制和子代理工具白名单。 当用户说"工具有哪些"、"搜索工具"、"查找技能"、"工具路由"时触发。
Installation
clawhub install tool-registry
Requires npm i -g clawhub
15
Downloads
0
Stars
0
current installs
0 all-time
1
Versions
Power your OpenClaw skills with
the best open-source models.
Drop-in OpenAI-compatible API. No data leaves Europe.
Explore Inference APIGLM
GLM 5
$1.00 / $3.20
per M tokens
Kimi
Kimi K2.5
$0.60 / $2.80
per M tokens
MiniMax
MiniMax M2.5
$0.30 / $1.20
per M tokens
Qwen
Qwen3.5 122B
$0.40 / $3.00
per M tokens
Tool Registry - 工具注册与发现系统
核心概念
用户输入 → Token提取 → 匹配工具 → 权限过滤 → 返回结果
↓
权重打分排序
工具注册表结构
const registry = new ToolRegistry();
registry.register({
name: 'read_file',
aliases: ['read', 'cat'], // 别名(短名称)
description: '读取文件内容',
permission: 'read', // 权限级别
agentTypes: ['explore', 'plan'], // 允许的子代理类型
keywords: ['file', 'read', '文本'], // 搜索关键词
execute: async (input) => { ... }
});
registry.register({
name: 'bash',
aliases: ['shell', 'exec'],
description: '执行Shell命令',
permission: 'danger',
agentTypes: ['verification'], // 只有验证代理能用
keywords: ['shell', 'bash', '命令', '执行'],
execute: async (input) => { ... }
});
权限级别
| 级别 | 值 | 说明 |
|---|---|---|
read |
1 | 只读文件/网络 |
write |
2 | 写入文件 |
danger |
3 | 危险操作(bash等) |
admin |
4 | 完全权限 |
子代理类型
| 类型 | 允许的工具 | 典型用途 |
|---|---|---|
explore |
read, glob, grep, web_fetch | 文件探索 |
plan |
read, todo, search | 规划分析 |
verification |
bash, read, assert | 验证测试 |
general |
全部 | 通用任务 |
Token 匹配算法
// 输入: "读取文件 test.py"
// Token化: ['读取', '文件', 'test.py']
// 匹配: read_file, file_read, cat 等
// 得分: 命中次数 + 位置权重 + 别名加权
// 排序: 得分从高到低
| 匹配位置 | 权重 |
|---|---|
| 别名匹配 | ×2 |
| 关键词匹配 | ×1 |
| 描述匹配 | ×0.5 |
API 使用
const { ToolRegistry } = require('./scripts/tool-registry.mjs');
// 创建注册表
const registry = new ToolRegistry();
// 注册工具
registry.register({
name: 'read_file',
aliases: ['read', 'cat'],
description: '读取文件内容',
permission: 'read',
agentTypes: ['explore', 'plan', 'general'],
keywords: ['file', 'read', 'open'],
execute: async (ctx, input) => {
return { success: true, content: '...' };
}
});
// 搜索工具(Token匹配)
const matches = registry.search('读文件');
// 返回: [{tool, score, matchType}] 数组
// 获取工具
const tool = registry.get('read_file');
// 按权限过滤
const allowedTools = registry.filterByPermission(currentPermission);
// 按代理类型过滤
const agentTools = registry.filterByAgentType('explore');
// 执行工具
const result = await registry.execute('read_file', { path: 'test.py' });
内置过滤器
// 权限不足过滤器
registry.withPermissionFilter(userLevel);
// 代理类型过滤器
registry.withAgentFilter(agentType);
// 组合过滤器
registry.withFilters({
permission: 'write',
agentType: 'plan',
exclude: ['dangerous_tool']
});
文件结构
tool-registry/
├── SKILL.md # 本文件
└── scripts/
└── tool-registry.mjs # 核心注册表实现
龙虾王子自我进化的成果 🦞
Statistics
Author
xhmqq616
@xhmqq616
Latest Changes
v1.0.0 · Apr 6, 2026
tool-registry 1.0.0 - Initial release of a token-based tool registry and discovery system with permission control and agent-type white-listing. - Supports tool search, registration, permission filtering, agent filtering, and score-based matching via keywords, aliases, and descriptions. - Integrated APIs for registering, searching, filtering, and executing tools. - Triggered by common user queries related to tools or skills.
Quick Install
clawhub install tool-registry Related Skills
Other popular skills you might find useful.
Chat with 100+ AI Models in one App.
Use Claude, ChatGPT, Gemini alongside with EU-Hosted Models like Deepseek, GLM-5, Kimi K2.5 and many more.