Fix(mcp): bound host_inspect, precheck remote_open, name the busy holder
Three smaller contract fixes that remove ways for an agent call to hang or fail without an explanation: - host_inspect with several aspects opens one sub-connection per aspect (5s ready + 12s list each), so all ten could run ~170s and outlive the caller's HTTP timeout. After 60s no new aspect is started; the running one finishes on its own timeout and the skipped ones land in errors.<aspect> with code -32001 and a "skipped:" message, so the model can retry with fewer aspects. - remote_open checked nothing before opening the hidden screen session. A Linux host that declares capability bits but not CLIENT_CAP_SCREEN_PREVIEW has no X11 display, so capture and injection cannot work: return -32005 immediately instead of waiting out timeout_ms and then reporting a sub-connection timeout. Android is deliberately excluded -- its SCREEN_PREVIEW bit tracks accessibility (API 30+ takeScreenshot for get_screenshot), while remote control uses MediaProjection capture and dispatchGesture, which can work without it. Old hosts with empty caps are still let through. - The -32003 busy errors in remote_open now append the DescribeBusy suffix (tool, elapsed), matching the other busy paths. tools.json descriptions are kept byte-identical to the C++ literals. Debug build green; check_platform_table, gen_go_tools --check and go test ./... pass. Co-Authored-By: deepseek-flash
This commit is contained in:
1 parent
d49ebe521d
commit
61b9031269
3 files changed
+46
-7
No files matched your search
+2
-2
@@ -1692,7 +1692,7 @@
|
||||
},
|
||||
{
|
||||
"name": "remote_open",
|
||||
"description": "在指定在线 Windows、Linux 或 Android 主机上建立远程控制会话(隐藏屏幕子连接)并返回 session_id、抓屏帧尺寸(screen_w/screen_h)与目标(target)。默认推整屏/整虚拟桌面(可能等比缩放);可用 window_hwnd 只推一个窗口,或用 region 只推一个矩形区域,带宽、延迟和点击精度都更好,此时归一化坐标 0..1 相对该目标帧。后续 remote_mouse/remote_keyboard 用归一化坐标(0..1)注入输入,用毕须 remote_close。Linux 需要 X11/Xorg(或 XWayland)桌面,纯 Wayland 会话无法抓屏/注入;window_hwnd/region 仅支持声明 CLIENT_CAP_WINDOW_INFO 的新 Windows 客户端。Windows 多显示器下整屏目标需要新版客户端(整虚拟桌面抓屏),老客户端会被拒绝;window 目标不依赖虚拟桌面抓屏,不受此限。Android 主机只支持整屏目标,输入被翻译成触摸手势与全局动作(见 remote_mouse / remote_keyboard);抓屏依赖客户端已授权录屏(MediaProjection),未授权时 remote_open 会一直等不到屏幕子连接,注入还依赖无障碍服务在跑(未开启时命令照样下发但不生效,且没有回执)。",
|
||||
"description": "在指定在线 Windows、Linux 或 Android 主机上建立远程控制会话(隐藏屏幕子连接)并返回 session_id、抓屏帧尺寸(screen_w/screen_h)与目标(target)。默认推整屏/整虚拟桌面(可能等比缩放);可用 window_hwnd 只推一个窗口,或用 region 只推一个矩形区域,带宽、延迟和点击精度都更好,此时归一化坐标 0..1 相对该目标帧。后续 remote_mouse/remote_keyboard 用归一化坐标(0..1)注入输入,用毕须 remote_close。Linux 需要 X11/Xorg(或 XWayland)桌面,纯 Wayland 会话无法抓屏/注入(这类主机直接返回 -32005);window_hwnd/region 仅支持声明 CLIENT_CAP_WINDOW_INFO 的新 Windows 客户端。Windows 多显示器下整屏目标需要新版客户端(整虚拟桌面抓屏),老客户端会被拒绝;window 目标不依赖虚拟桌面抓屏,不受此限。Android 主机只支持整屏目标,输入被翻译成触摸手势与全局动作(见 remote_mouse / remote_keyboard);抓屏依赖客户端已授权录屏(MediaProjection),未授权时 remote_open 会一直等不到屏幕子连接,注入还依赖无障碍服务在跑(未开启时命令照样下发但不生效,且没有回执)。",
|
||||
"gate": "remote_control",
|
||||
"write": true,
|
||||
"platforms": [
|
||||
@@ -3468,7 +3468,7 @@
|
||||
},
|
||||
{
|
||||
"name": "host_inspect",
|
||||
"description": "一次取回在线 Windows 主机的多类主机管理信息(原 10 个 host_list_* 工具合并)。aspects 必填、可多选:processes(进程:PID/架构/窗口标题/路径/优先级/线程数/用户/工作集与文件大小)| windows(当前可见顶层窗口;只含可见窗口,单次最多 96 条,超出时 truncated=true 且列表不完整,不能据此断定某窗口不存在;hwnd 可交给 host_control_window / operate_window)| network(网络连接,进程视角、含 UDP;与 list_network_connections 的「连接管理」数据源不同)| software(已安装软件,来自注册表 Uninstall 项;不提供卸载)| browser_history(IE 浏览历史,隐私数据)| favorites(IE 收藏夹,隐私数据)| win32_services(Win32 服务;服务名可用于 host_control_service)| driver_services(驱动服务;字段同 win32_services)| scheduled_tasks(计划任务;任务名 + folder 可用于 host_control_task)| hosts_file(按行返回并自动识别 UTF-8/GBK)。注意:win32_services / driver_services 要求客户端以管理员权限运行——非提权客户端拿不到 SCM 句柄后直接不回应,调用会在约 12 秒后超时(同等场景 list_services 会明确报 access denied)。过滤参数按 aspect 生效、其余忽略(见各参数说明),在服务端完成且先于分页:total 为命中数、totalAll 为该项全部条目数。单个 aspect 时顶层就是该项的列表结果(与合并前的旧工具一致);多个 aspect 时汇总在 results.<aspect>,某个 aspect 失败只记入 errors.<aspect>、不影响其它 aspect,全部失败才 isError=true。每多选一个 aspect 就多一次子连接,耗时线性增长,不需要的不要选。只读。",
|
||||
"description": "一次取回在线 Windows 主机的多类主机管理信息(原 10 个 host_list_* 工具合并)。aspects 必填、可多选:processes(进程:PID/架构/窗口标题/路径/优先级/线程数/用户/工作集与文件大小)| windows(当前可见顶层窗口;只含可见窗口,单次最多 96 条,超出时 truncated=true 且列表不完整,不能据此断定某窗口不存在;hwnd 可交给 host_control_window / operate_window)| network(网络连接,进程视角、含 UDP;与 list_network_connections 的「连接管理」数据源不同)| software(已安装软件,来自注册表 Uninstall 项;不提供卸载)| browser_history(IE 浏览历史,隐私数据)| favorites(IE 收藏夹,隐私数据)| win32_services(Win32 服务;服务名可用于 host_control_service)| driver_services(驱动服务;字段同 win32_services)| scheduled_tasks(计划任务;任务名 + folder 可用于 host_control_task)| hosts_file(按行返回并自动识别 UTF-8/GBK)。注意:win32_services / driver_services 要求客户端以管理员权限运行——非提权客户端拿不到 SCM 句柄后直接不回应,调用会在约 12 秒后超时(同等场景 list_services 会明确报 access denied)。过滤参数按 aspect 生效、其余忽略(见各参数说明),在服务端完成且先于分页:total 为命中数、totalAll 为该项全部条目数。单个 aspect 时顶层就是该项的列表结果(与合并前的旧工具一致);多个 aspect 时汇总在 results.<aspect>,某个 aspect 失败只记入 errors.<aspect>、不影响其它 aspect,全部失败才 isError=true。每多选一个 aspect 就多一次子连接,耗时线性增长,不需要的不要选;多个 aspect 共用 60 秒预算,用尽后不再下发新的 aspect(正在跑的会跑完),跳过的逐个记入 errors(code=-32001,message 以 skipped 开头),少选几项重试即可。只读。",
|
||||
"gate": "machine",
|
||||
"platforms": [
|
||||
"win"
|
||||
|
||||
Reference in new issue
Block a user