[ { "type": "function", "function": { "name": "code_run", "description": "针对 Windows 优化的双模态代码执行器。优先使用 python 运行复杂的脚本、逻辑和数据处理(需在回复中提供 ```python 代码块);仅在必要系统操作(如文件管理、环境变量设置)时使用 powershell。注意:不要在代码中放置大量数据,如有需要应通过文件读取。代码逻辑必须包含在回复的消息体中。", "parameters": { "type": "object", "properties": { "type": { "type": "string", "enum": [ "python", "powershell" ], "description": "执行模式。python 用于逻辑运算,powershell 用于单行指令。" }, "timeout": { "type": "integer", "default": 60, "description": "执行超时时间(秒)。" }, "cwd": { "type": "string", "description": "工作目录,默认为当前工作目录。" } }, "required": [ "type" ] } } }, { "type": "function", "function": { "name": "web_execute_js", "description": "浏览器控制的首选工具。通过执行 JavaScript 达成对网页的完全控制(如点击、滚动、提取特定数据)。支持将执行结果保存到文件供后续分析。注意:保存功能仅限即时读取,与 await 等异步操作不兼容。", "parameters": { "type": "object", "properties": { "script": { "type": "string", "description": "要执行的 JavaScript 代码。" }, "save_to_file": { "type": "string", "description": "(可选)将 JS 返回结果保存到指定的文件路径。" } }, "required": [ "script" ] } } }, { "type": "function", "function": { "name": "web_scan", "description": "获取网页的清洗后 HTML 内容。支持多标签页管理,可查看当前所有标签页并进行切换。应配合 execute_js 使用,减少全量观察 HTML 以提高效率。", "parameters": { "type": "object", "properties": { "focus_item": { "type": "string", "description": "语义过滤指令。在长列表中模糊搜寻相关项(如“搜索特定商品名称”),算法会优先保留匹配内容。" }, "switch_tab_id": { "type": "string", "description": "可选的标签页 ID。如果提供,将先切换到该标签页再进行扫描。" } } } } }, { "type": "function", "function": { "name": "file_read", "description": "读取文件内容。支持分页读取以处理大文件,默认每页 100 行并带有行号,方便 file_patch 定位。", "parameters": { "type": "object", "properties": { "path": { "type": "string", "description": "文件路径。" }, "start": { "type": "integer", "default": 1, "description": "起始行号(从 1 开始)。" }, "count": { "type": "integer", "default": 100, "description": "读取的行数。" }, "show_linenos": { "type": "boolean", "default": true, "description": "是否显示行号。" } }, "required": [ "path" ] } } }, { "type": "function", "function": { "name": "file_patch", "description": "对文件进行精细的局部修改。通过寻找唯一的旧文本块并替换为新文本。注意:必须确保 old_content 在文件中是唯一的,且空格、缩进、换行必须与原文件完全一致。如果替换失败,请先用 file_read 确认文件内容。", "parameters": { "type": "object", "properties": { "path": { "type": "string", "description": "目标文件路径。" }, "old_content": { "type": "string", "description": "要被替换的原始代码块(需确保唯一性)。" }, "new_content": { "type": "string", "description": "替换后的新代码块。" } }, "required": [ "path", "old_content", "new_content" ] } } }, { "type": "function", "function": { "name": "file_write", "description": "用于对整个文件进行覆盖写入或追加。主要用于创建新文件或处理文件的大量变更。具体写入的内容必须以代码块(```)的形式包含在回复的消息体中。", "parameters": { "type": "object", "properties": { "path": { "type": "string", "description": "目标文件路径。" }, "mode": { "type": "string", "enum": [ "overwrite", "append" ], "default": "overwrite", "description": "写入模式:overwrite(覆盖)或 append(追加)。" } }, "required": [ "path" ] } } }, { "type": "function", "function": { "name": "update_plan", "description": "同步宏观任务进度与战略重心。仅在涉及多步逻辑的初始拆解或发生重大方针变更(原方案不可行)时调用。严禁用于记录细微的调试步骤。简单任务无需使用。", "parameters": { "type": "object", "properties": { "plan": { "type": "string", "description": "更新后的宏观执行计划。" }, "focus": { "type": "string", "description": "当前阶段的战略重心。" } } } } }, { "type": "function", "function": { "name": "ask_user", "description": "当遇到无法自动决策、需要用户授权、需要用户提供私密信息或在关键节点需要确认时调用。调用后系统会暂停并等待人工介入。", "parameters": { "type": "object", "properties": { "question": { "type": "string", "description": "向用户提出的问题或请求。" }, "candidates": { "type": "array", "items": { "type": "string" }, "description": "提供给用户的可选快捷选项。" } }, "required": [ "question" ] } } } ]