tool-registry

工具注册与发现系统。基于Token匹配的工具路由,支持权限控制和子代理工具白名单。 当用户说"工具有哪些"、"搜索工具"、"查找技能"、"工具路由"时触发。

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "tool-registry" with this command: npx skills add xhmqq616/tool-registry

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) => { ... }
});

权限级别

级别说明
read1只读文件/网络
write2写入文件
danger3危险操作(bash等)
admin4完全权限

子代理类型

类型允许的工具典型用途
exploreread, glob, grep, web_fetch文件探索
planread, todo, search规划分析
verificationbash, 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 # 核心注册表实现

龙虾王子自我进化的成果 🦞

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Web3

Agent Arena Skill - on-chain ERC-8004 agent registry with x402-gated search and registration API

Discover, register, and hire ERC-8004 autonomous agents across 22,000+ agents on EVM + Solana. Search by capability, check on-chain reputation scores, compar...

Registry Source
9341Profile unavailable
General

Multi Find Skills(技能搜索全能版)

技能搜索全能版 | Multi Find Skills 触发场景:用户询问"有什么技能可以帮我..."、"找一个能做X的技能"、"有没有技能可以..."、"帮我搜一下XXX相关的技能"、"search for skill"、"找技能" 功能:三生态(ClawHub+LobeHub+skills.sh)搜索+质量核...

Registry SourceRecently Updated
1291Profile unavailable
General

企业年金查询技能 Pro

企业年金智能查询技能。搜索并确认企业年金信息,输出带来源链接和错误检查的标准化调查报告。只查询企业年金,不查询职业年金。

Registry SourceRecently Updated
1990Profile unavailable
General

Bing CN Search

使用必应中文搜索(Bing CN)获取互联网信息。当用户询问新闻、时事、需要搜索互联网内容、或提到"搜索一下"、"查一下"、"网上说"等场景时触发。

Registry SourceRecently Updated
3350Profile unavailable