diff --git a/plugins/ai_search.py b/plugins/ai_search.py index e0a0a9c..3ecc395 100644 --- a/plugins/ai_search.py +++ b/plugins/ai_search.py @@ -69,6 +69,32 @@ JSON格式示例: {\"action\": \"use_tool\", \"tool\": \"ai_search\", \"args\": \"web 什么是人工智能\"} - 搜索网络内容""" } + def get_mcp_definition(self): + return { + "name": "ai_search", + "description": "AI搜索工具,支持网址内容提取和网络搜索", + "inputSchema": { + "type": "object", + "properties": { + "operation": { + "type": "string", + "enum": ["search", "url", "web"], + "description": "操作类型: search(搜索), url(提取网址内容), web(网络搜索)" + }, + "query": { + "type": "string", + "description": "搜索词或网址" + } + }, + "required": ["operation", "query"] + } + } + + def convert_mcp_args(self, arguments): + op = arguments.get("operation", "") + query = arguments.get("query", "") + return f"{op} {query}" + def handle(self, args): """处理AI搜索请求""" try: diff --git a/plugins/audio_player.py b/plugins/audio_player.py index 9bcc65b..9a5d3e8 100644 --- a/plugins/audio_player.py +++ b/plugins/audio_player.py @@ -41,6 +41,25 @@ audio_player play - 播放音频文件 {"action": "use_tool", "tool": "audio_player", "args": "play"} - 播放音频文件 直接命令:/ciallo - 播放音频文件""" } + + def get_mcp_definition(self): + return { + "name": "audio_player", + "description": "音频播放工具", + "inputSchema": { + "type": "object", + "properties": { + "file": { + "type": "string", + "description": "音频文件路径(可选)" + } + } + } + } + + def convert_mcp_args(self, arguments): + return arguments.get("file", "") + def handle(self, args): """处理音频播放请求""" try: diff --git a/plugins/cmd_executor.py b/plugins/cmd_executor.py index f31ddfc..ef27fa1 100644 --- a/plugins/cmd_executor.py +++ b/plugins/cmd_executor.py @@ -60,6 +60,33 @@ cmd_executor <操作> <参数> {"action": "use_tool", "tool": "cmd_executor", "args": "run tasklist"} - 列出所有进程 注意:仅限Windows环境使用""" } + + def get_mcp_definition(self): + return { + "name": "cmd_executor", + "description": "CMD命令执行工具,用于执行系统命令行指令", + "inputSchema": { + "type": "object", + "properties": { + "operation": { + "type": "string", + "enum": ["run"], + "description": "操作类型,固定为 run" + }, + "command": { + "type": "string", + "description": "要执行的命令(如 dir, ipconfig, ls -la)" + } + }, + "required": ["operation", "command"] + } + } + + def convert_mcp_args(self, arguments): + op = arguments.get("operation", "run") + cmd = arguments.get("command", "") + return f"{op} {cmd}" + def handle(self, args): """处理CMD命令执行请求""" try: diff --git a/plugins/frontend_tester.py b/plugins/frontend_tester.py index 565b2c0..c65abeb 100644 --- a/plugins/frontend_tester.py +++ b/plugins/frontend_tester.py @@ -56,6 +56,32 @@ JSON格式示例: "usage": self.usage } + def get_mcp_definition(self): + return { + "name": "frontend_tester", + "description": "前端测试验证工具,支持HTML/CSS/JS自动化测试", + "inputSchema": { + "type": "object", + "properties": { + "operation": { + "type": "string", + "enum": ["validate", "lint", "test"], + "description": "操作类型" + }, + "target": { + "type": "string", + "description": "目标文件路径" + } + }, + "required": ["operation", "target"] + } + } + + def convert_mcp_args(self, arguments): + op = arguments.get("operation", "") + target = arguments.get("target", "") + return f"{op} {target}" + def handle(self, args): """处理前端测试请求""" try: diff --git a/plugins/network_tools.py b/plugins/network_tools.py index 122552d..7491ef6 100644 --- a/plugins/network_tools.py +++ b/plugins/network_tools.py @@ -79,6 +79,32 @@ JSON格式示例: {"action": "use_tool", "tool": "network_tools", "args": "ip www.example.com"} - 获取网站IP地址""" } + def get_mcp_definition(self): + return { + "name": "network_tools", + "description": "网络工具,用于测试连通性、获取网页内容、解析IP等", + "inputSchema": { + "type": "object", + "properties": { + "operation": { + "type": "string", + "enum": ["ping", "website", "headers", "ip"], + "description": "操作类型" + }, + "target": { + "type": "string", + "description": "目标网址或IP" + } + }, + "required": ["operation", "target"] + } + } + + def convert_mcp_args(self, arguments): + op = arguments.get("operation", "") + target = arguments.get("target", "") + return f"{op} {target}" + def handle(self, args): """处理网络工具请求""" try: diff --git a/plugins/task_manager.py b/plugins/task_manager.py index 6487cad..149f6f7 100644 --- a/plugins/task_manager.py +++ b/plugins/task_manager.py @@ -77,6 +77,32 @@ JSON格式示例: return f"保存任务失败: {e}" return None + def get_mcp_definition(self): + return { + "name": "task_manager", + "description": "任务管理工具,支持添加、完成、删除任务", + "inputSchema": { + "type": "object", + "properties": { + "operation": { + "type": "string", + "enum": ["add", "done", "delete", "list", "clear"], + "description": "操作类型" + }, + "task": { + "type": "string", + "description": "任务内容(add/done/delete 时使用)" + } + }, + "required": ["operation"] + } + } + + def convert_mcp_args(self, arguments): + op = arguments.get("operation", "") + task = arguments.get("task", "") + return f"{op} {task}".strip() + def handle(self, args): """处理任务管理请求""" try: diff --git a/plugins/tool_search.py b/plugins/tool_search.py index 12229de..b1fb5e4 100644 --- a/plugins/tool_search.py +++ b/plugins/tool_search.py @@ -42,6 +42,25 @@ JSON格式示例: - 帮助 AI 快速找到合适的工具而不需要预加载所有工具""" } + def get_mcp_definition(self): + return { + "name": "tool_search", + "description": "工具搜索插件,搜索可用工具的用法和信息", + "inputSchema": { + "type": "object", + "properties": { + "query": { + "type": "string", + "description": "搜索关键词或工具名" + } + }, + "required": ["query"] + } + } + + def convert_mcp_args(self, arguments): + return arguments.get("query", "") + def handle(self, args): """处理工具搜索请求""" try: