ai-mcp-tool-generator

Used when the AI encounters a task it cannot perform and must design and generate tools itself to complete the work. Core process: identify capability gap → design tool → generate script → sandbox validation → register for reuse. Intended to create custom tools, auto-generate scripts, and dynamically extend AI capabilities.

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "ai-mcp-tool-generator" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-f923bf9aa94458ff34240566d9c5e328558d97c96518e0317dcdd4a01c150ccc. Verify the upstream source and version against https://skillhub.cn/skills/user_638e256a/ai-mcp-tool-generator before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

skillhub.cn

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

Used when the AI encounters a task it cannot perform and must design and generate tools itself to complete the work. Core process: identify capability gap → design tool → generate script → sandbox validation → register for reuse. Intended to create custom tools, auto-generate scripts, and dynamically extend AI capabilities.

0 Downloads

Introduction source: third_party · user_638e256a · 1.0.0 Reference

SkillPi interpretation

Tasks
Translation pending; see source documentation.
Inputs and outputs
Translation pending; see source documentation.
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: ai-mcp-tool-generator
description: AI造工具 — 遇到不会的任务,AI自己造工具完成。当你需要创建自定义工具、自动生成脚本、扩展AI能力时使用此技能。核心流程:识别能力缺口→设计工具→生成脚本→沙箱验证→注册复用,让AI能力动态扩展。

AI造工具

概述

基于普林斯顿Alita的MCP工具自生成理念,让Agent在遇到无法完成的任务时能够自主创建MCP工具。从"人工堆砌工具"进化为"AI自主创造工具",实现能力的动态扩展。

核心架构

1. 能力评估器

识别当前Agent能力与任务需求之间的缺口:

  • 分析用户任务的具体需求
  • 匹配现有工具库的能力覆盖
  • 识别能力缺口并评估创建工具的可行性

2. 工具设计器

生成MCP工具的规格定义:

  • 工具名称和描述(符合MCP协议规范)
  • 输入参数schema定义
  • 输出格式规范
  • 依赖关系声明

3. 脚本生成器

生成符合MCP协议的可执行Python脚本:

  • 遵循MCP协议的消息格式
  • 实现工具的核心逻辑
  • 添加错误处理和日志记录
  • 支持标准输入输出交互

4. 沙箱验证器

在隔离环境中验证生成的工具:

  • 创建临时沙箱环境
  • 执行工具脚本
  • 捕获执行结果和错误
  • 验证工具行为符合预期

5. 错误修复器

当验证失败时自动分析和修复:

  • 解析错误信息定位问题
  • 生成修复建议
  • 修改脚本并重新验证
  • 最多重试3次

6. 工具注册表

管理已创建工具的元数据:

  • 工具ID和版本
  • 功能描述和标签
  • 使用次数统计
  • 依赖关系图

7. 安全约束引擎

确保生成的工具安全可靠:

  • 禁止访问敏感路径(/etc/passwd、/root、.ssh等)
  • 禁止执行危险命令(rm -rf、fork炸弹等)
  • 限制网络访问范围
  • 限制文件操作权限

工作流程

用户任务 → 能力评估 → 缺口识别
    ↓
工具设计 → 规格定义 → MCP协议兼容
    ↓
脚本生成 → Python代码 → MCP协议格式
    ↓
沙箱验证 → 隔离执行 → 结果验证
    ↓
失败? ──→ 错误修复 → 重试验证
    ↓
成功 → 工具注册 → 纳入复用库
    ↓
蒸馏效应 → 其他Agent可复用

输入参数

参数 类型 说明
task string 用户需要完成的任务描述
context string 任务上下文和约束条件
options object 可选:工具偏好、验证严格度等

输出格式

{
  "status": "success|failed|partial",
  "tool_id": "mcp_tool_xxx",
  "tool_name": "tool_name",
  "generated_code": "# Python MCP工具代码",
  "verification_result": {
    "passed": true,
    "output": "执行输出",
    "errors": []
  },
  "registration": {
    "registered": true,
    "version": "1.0.0",
    "tags": ["tag1", "tag2"]
  }
}

安全检查清单

生成工具时必须通过以下安全检查:

  • [ ] 不包含敏感路径访问
  • [ ] 不包含危险系统命令
  • [ ] 不包含恶意代码模式
  • [ ] 有限的文件操作权限
  • [ ] 受限的网络访问
  • [ ] 资源使用限制

示例

输入

task: "帮我获取某只股票的历史价格数据"
context: "需要支持多只股票查询,结果以CSV格式返回"

输出

{
  "status": "success",
  "tool_id": "mcp_tool_stock_history",
  "tool_name": "get_stock_history",
  "generated_code": "...",
  "verification_result": {
    "passed": true,
    "output": "成功获取AAPL 2024年历史数据"
  },
  "registration": {
    "registered": true,
    "version": "1.0.0"
  }
}

错误处理

错误类型 处理策略
能力缺口不可填补 返回详细说明,建议人工介入
脚本生成失败 记录失败原因,尝试重新生成
沙箱验证超时 减少工具复杂度或拆分任务
安全检查未通过 拒绝生成,提供安全修改建议
重试3次仍失败 返回失败报告,保留调试信息

输出质量约束(强制)

执行此技能时,输出必须满足以下要求,否则视为无效:

  1. 最低字数:每次输出不少于500字(中文字符),禁止仅输出框架标签或模板化摘要
  2. 必须包含具体内容:
    • 能力评估:必须明确列出当前能力缺口是什么、为什么现有工具无法满足
    • 工具设计:必须给出完整的工具规格(名称、描述、输入参数schema、输出格式),不能用省略号代替
    • 脚本生成:必须输出完整的可执行Python代码,包含核心逻辑、错误处理、MCP协议适配,不能只输出注释框架
    • 验证结果:必须给出具体的测试输入和预期输出,验证是否通过
    • 注册信息:必须包含工具ID、版本、标签、使用说明
  3. 禁止空话:不允许出现"建议查找资料"等回避性回答
  4. 代码必须完整可运行:不允许出现"...省略..."、"TODO"等占位符

输出示例

任务:获取股票历史价格数据

能力缺口:当前Agent没有股票数据获取工具,无法查询历史行情

工具设计:
- 名称:get_stock_history
- 描述:获取指定A股股票的历史价格数据
- 输入参数:
  - code(string,必填):股票代码,如"SH600519"
  - period(string,可选):"1d"/"1w"/"1m"/"3m"/"1y",默认"3m"
- 输出格式:
  - {"dates": [...], "opens": [...], "closes": [...], "highs": [...], "lows": [...], "volumes": [...]}

生成代码:
```python
import json
import sys
import urllib.request

def get_stock_history(code, period="3m"):
    """获取A股历史价格数据"""
    period_map = {"1d": 1, "1w": 5, "1m": 22, "3m": 66, "1y": 250}
    count = period_map.get(period, 66)
    # ... 完整实现代码 ...
    return {"dates": dates, "closes": closes, "volumes": volumes}

if __name__ == "__main__":
    params = json.loads(sys.stdin.read())
    result = get_stock_history(params["code"], params.get("period", "3m"))
    print(json.dumps(result))

验证:输入{"code":"SH600519","period":"1m"} → 预期返回30天价格数据 结果:通过

注册:mcp_tool_stock_history v1.0.0, tags=["finance","stock","data"]

Current listing version

1.0.0

Verify the source revision ↗

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value95/100

Highlights

  • AI自主创建MCP工具,解决能力缺口问题,实现能力动态扩展
  • 从'人工堆砌工具'进化为'AI自主创造工具',具有创新性
  • 适用于高频刚需场景,显著提升AI系统自动化能力
Trigger Precision95/100

Highlights

  • 触发词精准完整,明确描述'创建自定义工具、自动生成脚本、扩展AI能力'
  • 覆盖多种变体,边界清晰,不易误触或漏触
Structure and Standards95/100

Highlights

  • 文档结构完整,包含概述、核心架构、工作流程、输入参数、输出格式、示例、错误处理等
  • Phase/步骤清晰,有出口条件,含端到端示例
  • frontmatter完整,单文件长度适中
Execution Reliability90/100

Highlights

  • 工具来源明确,基于普林斯顿Alita的MCP理念
  • 参数定义清晰,覆盖主要异常场景
  • 有安全约束引擎和错误修复机制,最多重试3次
  • 包含详细的安全检查清单
Evidence Verifiability (mean of the first four)94/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.