JIT Tool Synthesis
JIT 工具合成 v4
基于 LLM 的按需工具生成系统,具备人工审核机制和安全执行环境。
概述
本系统利用 LLM 动态生成 TypeScript 工具,在执行前需要人工批准,并运行在沙箱环境中。
Related MCP server: code2mcp
架构
┌─────────────┐ ┌──────────────┐ ┌─────────────┐
│ Synthesizer │────▶│ Approval │────▶│ Sandbox │
│ (LLM) │ │ (Human Gate) │ │ (Execution) │
└─────────────┘ └──────────────┘ └─────────────┘
│ │ │
▼ ▼ ▼
Generates TS Waits for Runs in
tool code human approval isolated env组件
文件 | 用途 |
| 使用任何兼容 OpenAI 的 LLM 生成工具代码 |
| 人工审核门控 — 执行前必须获得批准 |
| 生成代码的安全执行环境 |
| 工具持久化与存储 |
| MCP 服务器集成 |
| 运行时配置管理 |
提供商无关性
本工具适用于任何兼容 OpenAI 的 LLM API:
OpenRouter — 100+ 模型 (Claude, GPT, Llama 等)
OpenAI — GPT-4o, o3 等
Ollama — 本地模型 (Llama, Qwen 等)
LM Studio — 带 GUI 的本地模型
Groq — 快速推理
任何其他兼容 OpenAI 的 API
设置
# Install dependencies
npm install
# Copy environment template
cp .env.example .env配置您的 LLM 提供商
编辑 .env 文件并填入您的提供商详情:
# Option 1: OpenRouter (default - 100+ models)
LLM_API_KEY=your-openrouter-key
LLM_BASE_URL=https://openrouter.ai/api/v1
LLM_MODEL=anthropic/claude-sonnet-4-6
# Option 2: OpenAI direct
LLM_API_KEY=sk-...
LLM_BASE_URL=https://api.openai.com/v1
LLM_MODEL=gpt-5.4
# Option 3: Ollama (local)
LLM_BASE_URL=http://localhost:11434/v1
LLM_MODEL=llama-3.3
# Option 4: Groq
LLM_API_KEY=gsk_...
LLM_BASE_URL=https://api.groq.com/openai/v1
LLM_MODEL=llama-3.3-70b-versatile使用方法
构建
npm run build使用 MCP Inspector 测试
验证一切是否正常的快捷方式:
npx @modelcontextprotocol/inspector node dist/server.js连接到 MCP 客户端
本服务器适用于任何 MCP 客户端。配置示例:
Claude Desktop — 添加到您的 Claude Desktop MCP 设置中:
{
"mcpServers": {
"jit-tool-synthesis": {
"command": "node",
"args": ["/absolute/path/to/jit-tool-synthesis/dist/server.js"],
"env": {
"LLM_API_KEY": "your-api-key",
"LLM_BASE_URL": "https://openrouter.ai/api/v1",
"LLM_MODEL": "anthropic/claude-sonnet-4-6"
}
}
}
}Claude Code:
claude mcp add jit-tools node /absolute/path/to/jit-tool-synthesis/dist/server.jsVS Code (Copilot):
code --add-mcp '{"name":"jit-tools","type":"stdio","command":"node","args":["/absolute/path/to/jit-tool-synthesis/dist/server.js"]}'Cursor — 添加到 .cursor/mcp.json:
{
"mcpServers": {
"jit-tools": {
"command": "node",
"args": ["/absolute/path/to/jit-tool-synthesis/dist/server.js"],
"env": { "LLM_API_KEY": "your-api-key" }
}
}
}运行时配置
您无需重启即可更改 LLM 提供商:
# View current config
get_config
# Change model at runtime
set_config model=openai/gpt-5.4MCP 工具
工具 | 描述 |
| 通过自然语言生成新工具 |
| 在批准前使用示例参数测试待定工具 |
| 激活待定工具 |
| 丢弃待定工具 |
| 运行已批准的工具 |
| 列出所有已批准的工具 |
| 查看工具详情 |
| 删除工具 |
| 列出等待批准的工具 |
| 查看 LLM 配置 |
| 在运行时更改 LLM 提供商/模型 |
工作流程
请求 — 用户提出工具需求(例如:“创建一个颜色转换器”)
合成 — LLM 生成工具代码
测试 — 在提交前使用示例参数进行验证
批准 — 人工审查并批准代码
执行 — 工具在沙箱环境中运行
存储 — 已批准的工具在会话间持久保存
环境变量
变量 | 描述 | 默认值 |
| 提供商的 API 密钥 | (云端必需) |
| API 端点 | |
| 使用的模型 | anthropic/claude-sonnet-4-6 |
同时支持(旧版):OPENROUTER_API_KEY, OPENAI_API_KEY, OPENAI_BASE_URL, SYNTHESIZER_MODEL
安全性
生成的代码运行在隔离的 VM 沙箱中
拦截模式可防止危险代码(process, require, eval 等)
API 密钥不会存储在配置文件中
状态
生产就绪 — 第一阶段已完成。
Available Tools
8 toolsapprove_toolApprove a synthesized toolD
| Name | Required | Description | Default |
|---|---|---|---|
| tool_name | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Tool has no description.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Tool has no description.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Tool has no description.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Tool has no description.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Tool has no description.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Tool has no description.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
execute_toolExecute an approved toolD
| Name | Required | Description | Default |
|---|---|---|---|
| tool_name | Yes | ||
| params | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Tool has no description.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Tool has no description.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Tool has no description.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Tool has no description.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Tool has no description.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Tool has no description.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_toolGet tool detailsD
| Name | Required | Description | Default |
|---|---|---|---|
| tool_name | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Tool has no description.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Tool has no description.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Tool has no description.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Tool has no description.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Tool has no description.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Tool has no description.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
list_pendingList pending toolsB
Returns a list of tools waiting for approval
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action ('Returns a list') but doesn't cover critical aspects like permissions needed, pagination, rate limits, or what constitutes 'pending' status. This leaves significant gaps for a tool that likely interacts with an approval workflow.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, efficient sentence that directly states the tool's function without any fluff. It's front-loaded and wastes no words, making it easy for an agent to parse quickly.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the complexity of managing pending tools in an approval system, the description is insufficient. With no annotations, no output schema, and siblings like 'approve_tool' and 'reject_tool', it should explain more about the approval context, return format, or how 'pending' is defined. It leaves too much undefined for effective use.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description appropriately doesn't discuss parameters, earning a high baseline score for not adding unnecessary information.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the verb ('Returns') and resource ('list of tools waiting for approval'), making the purpose specific and understandable. However, it doesn't explicitly differentiate from sibling tools like 'list_tools' or 'get_tool', which might also retrieve tool information, so it falls short of a perfect score.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives such as 'list_tools' or 'get_tool'. It lacks context about prerequisites, timing, or exclusions, leaving the agent to infer usage from the name alone.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
list_toolsList all available toolsB
Returns a list of all approved and available tools
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool returns a list but doesn't specify format, pagination, sorting, or any constraints like rate limits or authentication needs. For a tool with zero annotation coverage, this is a significant gap in transparency.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, efficient sentence that directly states the tool's purpose without any wasted words. It is front-loaded and appropriately sized for a simple tool with no parameters.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the lack of annotations and output schema, the description is incomplete. It doesn't explain what 'approved and available' means, the return format, or how this tool interacts with siblings. For a tool in a context with multiple related tools, more detail is needed to ensure proper use.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The tool has 0 parameters, and schema description coverage is 100%, so the schema already documents this fully. The description doesn't need to add parameter details, and it appropriately doesn't mention any. Baseline for 0 parameters is 4, as it avoids unnecessary information.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the verb ('Returns') and resource ('a list of all approved and available tools'), making the purpose understandable. However, it doesn't explicitly distinguish this tool from sibling tools like 'get_tool' or 'list_pending', which might have overlapping or related functionality.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives like 'get_tool' (for a single tool) or 'list_pending' (for pending tools). It lacks explicit context, prerequisites, or exclusions, leaving usage unclear in relation to siblings.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
reject_toolReject a synthesized toolD
| Name | Required | Description | Default |
|---|---|---|---|
| tool_name | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Tool has no description.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Tool has no description.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Tool has no description.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Tool has no description.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Tool has no description.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Tool has no description.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
remove_toolRemove an approved toolD
| Name | Required | Description | Default |
|---|---|---|---|
| tool_name | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Tool has no description.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Tool has no description.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Tool has no description.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Tool has no description.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Tool has no description.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Tool has no description.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
synthesize_toolSynthesize a new toolB
Describe a capability you need and this will generate a working tool. Returns a pending tool that needs approval before it becomes available.
| Name | Required | Description | Default |
|---|---|---|---|
| description | Yes | What the tool should do | |
| example_input | No | Example input to guide generation | |
| example_output | No | Expected output format |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden. It discloses that the tool generates a pending tool requiring approval, which is useful behavioral context. However, it lacks details on permissions needed, rate limits, error conditions, or what 'pending' entails operationally (e.g., storage, visibility). For a mutation tool with zero annotation coverage, this is a significant gap in transparency.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is two sentences that are front-loaded and efficient: the first states the action and input, the second specifies the output and approval requirement. Every sentence earns its place with no wasted words, making it highly concise and well-structured.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's complexity (generating new tools with 3 parameters), lack of annotations, and no output schema, the description is minimally adequate. It covers the core purpose and approval workflow but misses details like error handling, return format, or integration with siblings. It's complete enough for basic understanding but has clear gaps for effective agent use.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the schema already documents all three parameters ('description', 'example_input', 'example_output') with their purposes. The description doesn't add any parameter-specific semantics beyond what the schema provides, such as formatting tips or interdependencies. Baseline 3 is appropriate when the schema does the heavy lifting.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose: 'generate a working tool' based on a described capability, with the specific outcome of returning 'a pending tool that needs approval'. It uses specific verbs ('generate', 'returns') and identifies the resource ('tool'), but doesn't explicitly differentiate from siblings like 'approve_tool' or 'execute_tool' in terms of workflow role.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage context by stating it 'generates a working tool' and that the result 'needs approval before it becomes available', which suggests it's part of a tool creation workflow. However, it doesn't explicitly state when to use this versus alternatives like 'approve_tool' or 'execute_tool', nor does it provide clear exclusions or prerequisites for use.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
8 tool updates
v2.0.0- First observed
approve_tool - First observed
execute_tool - First observed
get_tool - First observed
list_pending - First observed
list_tools - First observed
reject_tool - First observed
remove_tool - First observed
synthesize_tool
TDQS
Scored across 8 tools
Most tools have distinct purposes: list_pending and list_tools are clearly different (pending vs. all tools), synthesize_tool creates new tools, and approve_tool/reject_tool/remove_tool handle tool lifecycle. However, get_tool lacks a description, making its distinction from list_tools ambiguous—it might fetch a single tool's details, but this is unclear without context.
All tool names follow a consistent verb_noun pattern with snake_case, such as approve_tool, execute_tool, get_tool, list_pending, list_tools, reject_tool, remove_tool, and synthesize_tool. This uniformity makes the set predictable and easy to understand at a glance.
With 8 tools, this server is well-scoped for managing a tool synthesis and approval workflow. The count supports core operations like listing, creating, approving, rejecting, removing, and executing tools, without being overly sparse or bloated.
The tool set covers a complete lifecycle for tool synthesis: create (synthesize_tool), list (list_pending, list_tools), approve/reject (approve_tool, reject_tool), remove (remove_tool), and execute (execute_tool). A minor gap is the lack of descriptions for tools like get_tool, which might hinder full coverage if it's meant for detailed retrieval, but the core workflow is well-supported.
Maintenance
Related MCP Connectors
Runtime permission, approval, and audit layer for AI agent tool execution.
Give any MCP-compatible AI assistant a builder for live, hosted web tools and workflows.
- AxiomOAuthcom.axiomide
The marketplace where agents don't just use tools — they build, publish, and compose new ones.
MCP server for your apps' tools and custom tools, plus hosted AI agents and approval-gated workflows
Related MCP Servers
- AlicenseAqualityFmaintenanceEnables AI models to dynamically create and execute their own custom tools through a meta-function architecture, supporting JavaScript, Python, and Shell runtimes with sandboxed security and human approval flows.510MIT
- FlicenseAqualityNot gradedmaintenanceEnables execution of TypeScript code to call MCP tools instead of direct tool calls, reducing token usage by up to 98% while orchestrating complex multi-tool workflows through secure sandboxed code execution.1-
- AlicenseAqualityDmaintenanceEnables AI-powered generation of production-ready CTP (ConveniencePro Tool Protocol) tools from natural language descriptions, including tool definitions, implementations, tests, and TypeScript validation.57 npmMIT
- AlicenseAqualityBmaintenanceEnables dynamic creation and execution of custom tools/functions in multiple programming languages at runtime, exposing them to MCP clients like Claude.49 npm44MIT