Feature: Support host uninstall on Android and expose uninstall_host
The server's "uninstall host" action is the single-byte TOKEN_UNINSTALL on the main connection. Windows clients have handled it for a long time; the Android client ignored it, so the menu entry silently did nothing there. Handle it in the Android client the only way Android allows: ask the system to uninstall the package. The client first replies with COMMAND_BYE and drops the connection, then opens the package installer's confirmation dialog through the accessibility service, or posts a notification that resumes the dialog from MainActivity when accessibility is off. The user still has to confirm on the device; if they cancel, the client has already left the server and must be reopened by hand. The manifest gains REQUEST_DELETE_PACKAGES, without which the installer activity refuses the request outright. New APKs advertise CLIENT_CAP_UNINSTALL so the server can reject old clients instead of sending a command nobody handles. The new MCP tool uninstall_host is gated on McpManage and McpReadonly=0, rejects Linux and macOS hosts, and offers the same wait=true verification as power_action, reporting went_offline once the host disappears from the online list. Verified on the emulator end to end: the tool returned went_offline after 200 ms, the system dialog appeared, confirming it removed the package. Co-Authored-By: deepseek-flash
This commit is contained in:
1 parent
fd1b085279
commit
29d7ee1a18
12 files changed
+362
-8
No files matched your search
+55
-1
@@ -15,7 +15,7 @@
|
||||
],
|
||||
"version": 2,
|
||||
"protocolVersion": "2025-06-18",
|
||||
"toolCount": 62,
|
||||
"toolCount": 63,
|
||||
"tools": [
|
||||
{
|
||||
"name": "list_online_hosts",
|
||||
@@ -3283,6 +3283,60 @@
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "uninstall_host",
|
||||
"description": "卸载指定在线主机上的被控程序(不可撤销)。报文是单字节 TOKEN_UNINSTALL,与主控在线列表右键「卸载主机」完全一样:Windows 客户端会退出并延时删除自身;Android 客户端会先回 BYE,再拉起系统的卸载确认框(Android 不允许静默卸载,必须有人在设备上点「确定」;没人确认就不会真的删除,Android 客户端却已按卸载退出连接,需要人工重开 App)。Linux/macOS 客户端没有该分支,返回 -32005。没有回执:ok/sent 只代表命令已送达;要确认主机确实消失就传 wait=true,工具会等它从在线列表下线。卸载后主机不会自动回来。",
|
||||
"gate": "manage",
|
||||
"write": true,
|
||||
"platforms": [
|
||||
"win",
|
||||
"apk"
|
||||
],
|
||||
"impl": "mfc",
|
||||
"inputSchema": {
|
||||
"properties": {
|
||||
"id": {
|
||||
"description": "主机 id,取 list_online_hosts / search_hosts 返回的 id 字段",
|
||||
"type": "string"
|
||||
},
|
||||
"wait": {
|
||||
"description": "true 时等主机从在线列表消失再返回(默认 false,发完即走)。卸载后主机不会回线。",
|
||||
"type": "boolean"
|
||||
},
|
||||
"wait_ms": {
|
||||
"description": "wait=true 时的最长等待(毫秒,默认 30000)",
|
||||
"maximum": 600000,
|
||||
"minimum": 1000,
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"id"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"outputSchema": {
|
||||
"properties": {
|
||||
"elapsed_ms": {
|
||||
"description": "本次等待实际耗时(毫秒;wait=false 时为 0)",
|
||||
"type": "integer"
|
||||
},
|
||||
"ok": {
|
||||
"description": "命令已下发(不代表已经卸载)",
|
||||
"type": "boolean"
|
||||
},
|
||||
"sent": {
|
||||
"description": "命令已送达主机",
|
||||
"type": "boolean"
|
||||
},
|
||||
"went_offline": {
|
||||
"description": "主机是否已从在线列表消失(wait=true 时观察到的;wait=false 恒为 false)",
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "host_set_remark",
|
||||
"description": "给主机设置备注(在线或离线历史记录都可)。只写入服务端本地主机库,不向客户端下发任何命令;remark 传空字符串表示清除备注,GBK 编码后最长 63 字节。",
|
||||
|
||||
Reference in new issue
Block a user