Files
GenericAgent/assets/tools_schema.json

68 lines
5.9 KiB
JSON
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
[
{"type": "function", "function": {
"name": "code_run",
"description": "代码执行器。优先使用python仅在必要系统操作时使用 powershell。注意执行的代码必须放在在回复正文中以 ```python 或 ```powershell 代码块的形式。严禁在代码中硬编码大量数据,如有需要应通过文件读取。",
"parameters": {"type": "object", "properties": {
"type": {"type": "string", "enum": ["python", "powershell"], "description": "执行环境类型,默认为 python。", "default": "python"},
"timeout": {"type": "integer", "description": "执行超时时间(秒),默认 60。", "default": 60},
"cwd": {"type": "string", "description": "工作目录,默认为当前工作目录。"}}}
}},
{"type": "function", "function": {
"name": "file_read",
"description": "读取文件内容。建议在修改文件前先读取,以确保获取最新的上下文和行号。支持分页读取或关键字搜索。",
"parameters": {"type": "object", "properties": {
"path": {"type": "string", "description": "文件相对或绝对路径。"},
"start": {"type": "integer", "description": "起始行号(从 1 开始)。", "default": 1},
"count": {"type": "integer", "description": "读取的行数。", "default": 100},
"keyword": {"type": "string", "description": "可选搜索关键字。如果提供,将返回第一个匹配项(忽略大小写)及其周边的内容。"},
"show_linenos": {"type": "boolean", "description": "是否显示行号,建议开启以辅助 file_patch 定位。", "default": true}}, "required": ["path"]}
}},
{"type": "function", "function": {
"name": "file_patch",
"description": "精细化局部文件修改。在文件中寻找唯一的 old_content 块并替换为 new_content。要求 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": "用于文件的新建、全量覆盖或追加写入。对于精细的代码修改,应优先使用 file_patch。注意要写入的内容必须放在回复正文的 <file_content> 标签或代码块中。",
"parameters": {"type": "object", "properties": {
"path": {"type": "string", "description": "文件路径。"},
"mode": {"type": "string", "enum": ["overwrite", "append", "prepend"], "description": "写入模式覆盖、追加或在开头追加。", "default": "overwrite"}}, "required": ["path"]}
}},
{"type": "function", "function": {
"name": "web_scan",
"description": "获取当前页面的简化HTML内容和标签页列表。注意简化会过滤边栏、浮动元素等非主体内容如需查看被过滤内容请用execute_js。切换页面后一般应先调用查看。",
"parameters": {"type": "object", "properties": {
"tabs_only": {"type": "boolean", "description": "仅返回标签页列表和当前标签信息不获取HTML内容。", "default": false},
"switch_tab_id": {"type": "string", "description": "可选的标签页 ID。如果提供系统将在扫描前切换到该标签页。"}}}
}},
{"type": "function", "function": {
"name": "web_execute_js",
"description": "万能网页操控工具。通过执行 JavaScript 脚本实现对浏览器的完全控制如点击、滚动、提取特定数据。鼓励在有把握情况下记忆中有selector/做法等精准使用以减少web_scan调用。执行结果可选择保存到本地文件进行后续分析。",
"parameters": {"type": "object", "properties": {
"script": {"type": "string", "description": "要执行的 JavaScript 代码。"},
"save_to_file": {"type": "string", "description": "可选。将 JS 执行结果js_return保存到的文件路径。该功能不支持 await 等异步结果。"}}, "required": ["script"]}
}},
{"type": "function", "function": {
"name": "update_working_mem",
"description": "更新当前任务的工作记忆。当任务目标细化、阶段切换或发现关键物理约束时调用内容不得超过200 tokens将作为物理锚点在后续每轮自动注入强行锁定推理方向防止长程任务逻辑漂移。",
"parameters": {"type": "object", "properties": {
"key_info": {"type": "string", "description": "替换掉当前的极简关键信息(<200 tokens包含当前进度和目标、已获取的关键信息及下一步必须绕过的坑已经解决或完成的步骤可以去掉"},
"related_sop": {"type": "string", "description": "相关sop名称可以多个必要时需要再读"}}}
}},
{"type": "function", "function": {
"name": "ask_user",
"description": "当需要用户决策、提供额外信息或遇到无法自动解决的阻碍时,调用此工具中断任务并提问。",
"parameters": {"type": "object", "properties": {
"question": {"type": "string", "description": "向用户提出的明确问题。"},
"candidates": {"type": "array", "items": {"type": "string"}, "description": "提供给用户的可选快捷选项列表。"}}, "required": ["question"]}
}},
{"type": "function", "function": {
"name": "trigger_memory_update",
"description": "若发现值得长期记忆的信息(环境事实/用户偏好/避坑经验),调用此工具触发记忆提炼。一次用户对话只允许调用一次,严禁在记忆更新或自主流程内调用。",
"parameters": {"type": "object", "properties": {}}}
}
]