Feature(mcp): merge the three host-list tools into list_hosts

list_online_hosts, search_hosts and list_all_hosts differed only in
whether offline hosts were included and in which filter fields they
accepted, which made the host-list surface confusing and duplicated
three handlers over the same CollectAllHosts snapshot.

They now share one tool, list_hosts(query?, online?=true,
include_offline?=false, group?, os?, client_type?, limit?, offset?).
The old names stay as aliases routed to the same handler, so existing
callers keep working, but tools/list exposes only list_hosts. The
legacy "offline" boolean of list_all_hosts is still honored, and
list_all_hosts keeps its online+offline default.

With offline history included the list is now ordered online-first:
the host library holds thousands of records, so the default page of
100 would otherwise be all stale entries and the online hosts a caller
can actually operate on would be buried behind paging.

instructions, every id-description string, the platform table, the
tools.json generator and the captured mcp/tools.json are updated to
the new name (65 tools -> 63).

Co-Authored-By: deepseek-flash
This commit is contained in:
yuanyuanxianganddeepseek-flash committed 2026-11-12 17:01:16 +01:00
1 parent 613aa7291a
commit 88269df548
3 files changed
+191 -481

No files matched your search

+45 -275
View File
@@ -15,11 +15,11 @@
],
"version": 2,
"protocolVersion": "2025-06-18",
"toolCount": 65,
"toolCount": 63,
"tools": [
{
"name": "list_online_hosts",
"description": "获取当前所有在线主机的列表,包含计算机名、IP、操作系统、版本、备注、分组、活动窗口、延迟等实时信息。可选 group / os / client_type 三个过滤条件(均可选、AND 组合、子串匹配、ASCII 不区分大小写),过滤在分页之前生效:total 为命中台数,totalAll 为全部在线台数。结果按 limit/offset 分页(默认 100 条,上限 1000),hasMore 表示还有下一页。tls=true 表示该客户端登录时使用了 TLS 加密传输(登录时上报,非实时探测;老客户端恒为 false)。",
"name": "list_hosts",
"description": "列主机:默认只返回在线主机(含计算机名、IP、操作系统、版本、备注、分组、活动窗口、延迟等实时信息),include_offline=true 时连离线主机(历史连接过、当前未连接,来自主机列表记录)一起返回,在线主机排在最前面。query 子串匹配计算机名/备注/IP;group / os / client_type 为附加过滤条件(均可选、AND 组合、子串匹配、ASCII 不区分大小写);online=false 只看离线主机。过滤在分页之前生效:total 为命中台数,totalAll 为过滤前的主机库台数。结果按 limit/offset 分页(默认 100 条,上限 1000),hasMore 表示还有下一页。离线主机另有 last_seen(最后一次登录时间)、install_time 字段,但没有 rtt/version/activeWindow 等实时字段,也没有 clientType(按平台筛历史主机请用 os),group 恒为 default。authStatus 为主机授权状态(unauthorized/authorized_by_super/authorized_by_admin/forbidden)。tls=true 表示该客户端登录时使用了 TLS 加密传输(登录时上报,老客户端恒为 false)。",
"gate": null,
"platforms": [
"win",
@@ -38,122 +38,12 @@
"description": "按分组过滤(子串,不区分大小写)。省略则不过滤。",
"type": "string"
},
"limit": {
"description": "本次最多返回的条数,默认 100,上限 1000。",
"type": "integer"
},
"offset": {
"description": "跳过前 N 条,默认 0;配合返回的 total/hasMore 翻页。",
"type": "integer"
},
"os": {
"description": "按操作系统过滤(子串,不区分大小写,如 Windows、Linux、Android)。省略则不过滤。",
"type": "string"
}
},
"required": [],
"type": "object"
},
"outputSchema": {
"properties": {
"hasMore": {
"include_offline": {
"description": "是否把离线主机一起返回,默认 false(只给在线);online=false 时无意义。list_all_hosts 别名默认 true。",
"type": "boolean"
},
"hosts": {
"items": {
"properties": {
"activeWindow": {
"type": "string"
},
"authStatus": {
"type": "string"
},
"clientType": {
"type": "string"
},
"group": {
"type": "string"
},
"id": {
"type": "string"
},
"install_time": {
"type": "string"
},
"ip": {
"type": "string"
},
"last_seen": {
"type": "string"
},
"location": {
"type": "string"
},
"name": {
"type": "string"
},
"online": {
"type": "boolean"
},
"os": {
"type": "string"
},
"remark": {
"type": "string"
},
"rtt": {
"type": "string"
},
"screen": {
"type": "string"
},
"tls": {
"type": "boolean"
},
"version": {
"type": "string"
}
},
"type": "object"
},
"type": "array"
},
"limit": {
"type": "integer"
},
"offset": {
"type": "integer"
},
"total": {
"type": "integer"
},
"totalAll": {
"type": "integer"
}
},
"required": [
"hosts"
],
"type": "object"
}
},
{
"name": "search_hosts",
"description": "按计算机名/备注、IP、分组、操作系统过滤主机。所有条件均可选、按 AND 组合;子串匹配(ASCII 不区分大小写)。online=true 只返回在线主机,online=false 只返回离线主机(曾连接过、当前未连接),省略时只返回在线主机。离线主机的 group 恒为 default,last_seen 为最后一次登录时间;两类都要请用 list_all_hosts。结果按 limit/offset 分页(默认 100 条,上限 1000),total 为匹配总数。tls=true 表示该客户端登录时使用了 TLS 加密传输(登录时上报,老客户端恒为 false)。",
"gate": null,
"platforms": [
"win",
"lnx",
"mac",
"apk"
],
"impl": "mfc",
"inputSchema": {
"properties": {
"group": {
"type": "string"
},
"ip": {
"description": "只按 IP 过滤(search_hosts 的旧参数);与 query 同时给出时两者都需满足。",
"type": "string"
},
"limit": {
@@ -161,6 +51,7 @@
"type": "integer"
},
"name": {
"description": "只按计算机名/备注过滤(search_hosts 的旧参数);与 query 同时给出时两者都需满足。",
"type": "string"
},
"offset": {
@@ -168,137 +59,16 @@
"type": "integer"
},
"online": {
"type": "boolean"
},
"os": {
"type": "string"
}
},
"type": "object"
},
"outputSchema": {
"properties": {
"hasMore": {
"type": "boolean"
},
"hosts": {
"items": {
"properties": {
"activeWindow": {
"type": "string"
},
"authStatus": {
"type": "string"
},
"clientType": {
"type": "string"
},
"group": {
"type": "string"
},
"id": {
"type": "string"
},
"install_time": {
"type": "string"
},
"ip": {
"type": "string"
},
"last_seen": {
"type": "string"
},
"location": {
"type": "string"
},
"name": {
"type": "string"
},
"online": {
"type": "boolean"
},
"os": {
"type": "string"
},
"remark": {
"type": "string"
},
"rtt": {
"type": "string"
},
"screen": {
"type": "string"
},
"tls": {
"type": "boolean"
},
"version": {
"type": "string"
}
},
"type": "object"
},
"type": "array"
},
"limit": {
"type": "integer"
},
"offset": {
"type": "integer"
},
"total": {
"type": "integer"
},
"totalAll": {
"type": "integer"
}
},
"required": [
"hosts"
],
"type": "object"
}
},
{
"name": "list_all_hosts",
"description": "列出服务端已知的全部主机:在线主机(实时信息)与离线主机(历史连接过、当前未连接,来自主机列表记录)。在线主机字段同 list_online_hosts;离线主机另有 last_seen(最后一次登录时间)、install_time 字段,但没有 rtt/version/activeWindow 等实时字段,也没有 clientType。authStatus 为主机授权状态(unauthorized/authorized_by_super/authorized_by_admin/forbidden)。默认两类都返回;可选 group / os / client_type 过滤(AND 组合、子串匹配、ASCII 不区分大小写),过滤在分页之前生效:total 为命中台数,totalAll 为主机库总数。结果按 limit/offset 分页(默认 100 条,上限 1000)。",
"gate": null,
"platforms": [
"win",
"lnx",
"mac",
"apk"
],
"impl": "mfc",
"inputSchema": {
"properties": {
"client_type": {
"description": "按客户端类型过滤(子串,不区分大小写,如 EXE、LNX、MAC)。离线主机没有该字段,不会命中。省略则不过滤。",
"type": "string"
},
"group": {
"description": "按分组过滤(子串,不区分大小写)。省略则不过滤。",
"type": "string"
},
"limit": {
"description": "本次最多返回的条数,默认 100,上限 1000。",
"type": "integer"
},
"offline": {
"description": "是否包含离线主机(历史连接过、当前未连接的),默认 true",
"type": "boolean"
},
"offset": {
"description": "跳过前 N 条,默认 0;配合返回的 total/hasMore 翻页。",
"type": "integer"
},
"online": {
"description": "是否包含在线主机,默认 true",
"description": "true(默认)返回在线主机;false 只返回离线主机(历史连接过、当前未连接)。",
"type": "boolean"
},
"os": {
"description": "按操作系统过滤(子串,不区分大小写,如 Windows、Linux、Android)。省略则不过滤。",
"type": "string"
},
"query": {
"description": "关键字:子串匹配计算机名、备注或 IP(ASCII 不区分大小写)。省略则不过滤。",
"type": "string"
}
},
"type": "object"
@@ -412,7 +182,7 @@
],
"properties": {
"id": {
"description": "主机 id,取 list_online_hosts / search_hosts 返回的 id 字段;与 ids 二选一",
"description": "主机 id,取 list_hosts 返回的 id 字段;与 ids 二选一",
"type": "string"
},
"ids": {
@@ -613,7 +383,7 @@
],
"properties": {
"id": {
"description": "主机 id,取 list_online_hosts / search_hosts 返回的 id 字段;与 ids 二选一",
"description": "主机 id,取 list_hosts 返回的 id 字段;与 ids 二选一",
"type": "string"
},
"ids": {
@@ -770,7 +540,7 @@
],
"properties": {
"id": {
"description": "主机 id,取 list_online_hosts / search_hosts 返回的 id 字段;与 ids 二选一",
"description": "主机 id,取 list_hosts 返回的 id 字段;与 ids 二选一",
"type": "string"
},
"ids": {
@@ -929,7 +699,7 @@
],
"properties": {
"id": {
"description": "主机 id,取 list_online_hosts / search_hosts 返回的 id 字段;与 ids 二选一",
"description": "主机 id,取 list_hosts 返回的 id 字段;与 ids 二选一",
"type": "string"
},
"ids": {
@@ -1071,7 +841,7 @@
]
},
"id": {
"description": "主机 id,取 list_online_hosts / search_hosts 返回的 id 字段",
"description": "主机 id,取 list_hosts 返回的 id 字段",
"type": "string"
},
"max_width": {
@@ -1173,7 +943,7 @@
"inputSchema": {
"properties": {
"id": {
"description": "主机 id,取 list_online_hosts / search_hosts 返回的 id 字段",
"description": "主机 id,取 list_hosts 返回的 id 字段",
"type": "string"
}
},
@@ -1270,7 +1040,7 @@
],
"properties": {
"id": {
"description": "主机 id,取 list_online_hosts / search_hosts 返回的 id 字段",
"description": "主机 id,取 list_hosts 返回的 id 字段",
"type": "string"
},
"ids": {
@@ -1446,7 +1216,7 @@
],
"properties": {
"id": {
"description": "主机 id,取 list_online_hosts / search_hosts 返回的 id 字段;与 ids 二选一",
"description": "主机 id,取 list_hosts 返回的 id 字段;与 ids 二选一",
"type": "string"
},
"ids": {
@@ -1605,7 +1375,7 @@
"type": "string"
},
"id": {
"description": "主机 id,取 list_online_hosts / search_hosts 返回的 id 字段;与 ids 二选一",
"description": "主机 id,取 list_hosts 返回的 id 字段;与 ids 二选一",
"type": "string"
},
"ids": {
@@ -1731,7 +1501,7 @@
"type": "integer"
},
"id": {
"description": "主机 id,取 list_online_hosts / search_hosts 返回的 id 字段",
"description": "主机 id,取 list_hosts 返回的 id 字段",
"type": "string"
},
"max_bytes": {
@@ -2024,7 +1794,7 @@
],
"properties": {
"id": {
"description": "主机 id,取 list_online_hosts / search_hosts 返回的 id 字段;与 ids 二选一",
"description": "主机 id,取 list_hosts 返回的 id 字段;与 ids 二选一",
"type": "string"
},
"ids": {
@@ -2156,7 +1926,7 @@
"type": "string"
},
"id": {
"description": "主机 id,取 list_online_hosts / search_hosts 返回的 id 字段",
"description": "主机 id,取 list_hosts 返回的 id 字段",
"type": "string"
},
"timeout_ms": {
@@ -2202,7 +1972,7 @@
"inputSchema": {
"properties": {
"id": {
"description": "主机 id,取 list_online_hosts / search_hosts 返回的 id 字段",
"description": "主机 id,取 list_hosts 返回的 id 字段",
"type": "string"
},
"timeout_ms": {
@@ -2255,7 +2025,7 @@
"type": "string"
},
"id": {
"description": "主机 id,取 list_online_hosts / search_hosts 返回的 id 字段",
"description": "主机 id,取 list_hosts 返回的 id 字段",
"type": "string"
},
"max_output_bytes": {
@@ -2337,7 +2107,7 @@
"inputSchema": {
"properties": {
"id": {
"description": "主机 id,取 list_online_hosts / search_hosts 返回的 id 字段",
"description": "主机 id,取 list_hosts 返回的 id 字段",
"type": "string"
},
"session_id": {
@@ -2378,7 +2148,7 @@
"inputSchema": {
"properties": {
"id": {
"description": "主机 id,取 list_online_hosts / search_hosts 返回的 id 字段",
"description": "主机 id,取 list_hosts 返回的 id 字段",
"type": "string"
},
"region": {
@@ -2488,7 +2258,7 @@
"inputSchema": {
"properties": {
"id": {
"description": "主机 id,取 list_online_hosts / search_hosts 返回的 id 字段",
"description": "主机 id,取 list_hosts 返回的 id 字段",
"type": "string"
},
"session_id": {
@@ -2540,7 +2310,7 @@
]
},
"id": {
"description": "主机 id,取 list_online_hosts / search_hosts 返回的 id 字段",
"description": "主机 id,取 list_hosts 返回的 id 字段",
"type": "string"
},
"key": {
@@ -2651,7 +2421,7 @@
]
},
"id": {
"description": "主机 id,取 list_online_hosts / search_hosts 返回的 id 字段",
"description": "主机 id,取 list_hosts 返回的 id 字段",
"type": "string"
},
"report_foreground": {
@@ -2742,7 +2512,7 @@
"inputSchema": {
"properties": {
"id": {
"description": "主机 id,取 list_online_hosts / search_hosts 返回的 id 字段",
"description": "主机 id,取 list_hosts 返回的 id 字段",
"type": "string"
},
"session_id": {
@@ -2778,7 +2548,7 @@
"inputSchema": {
"properties": {
"id": {
"description": "主机 id,取 list_online_hosts / search_hosts 返回的 id 字段",
"description": "主机 id,取 list_hosts 返回的 id 字段",
"type": "string"
},
"session_id": {
@@ -2814,7 +2584,7 @@
"type": "boolean"
},
"id": {
"description": "主机 id,取 list_online_hosts / search_hosts 返回的 id 字段",
"description": "主机 id,取 list_hosts 返回的 id 字段",
"type": "string"
},
"max_block_ms": {
@@ -2870,7 +2640,7 @@
"inputSchema": {
"properties": {
"id": {
"description": "主机 id,取 list_online_hosts / search_hosts 返回的 id 字段",
"description": "主机 id,取 list_hosts 返回的 id 字段",
"type": "string"
},
"local_dir": {
@@ -2943,7 +2713,7 @@
"type": "string"
},
"id": {
"description": "主机 id,取 list_online_hosts / search_hosts 返回的 id 字段",
"description": "主机 id,取 list_hosts 返回的 id 字段",
"type": "string"
},
"limit": {
@@ -3051,7 +2821,7 @@
"type": "object"
},
"id": {
"description": "主机 id,取 list_online_hosts / search_hosts 返回的 id 字段",
"description": "主机 id,取 list_hosts 返回的 id 字段",
"type": "string"
},
"max_bytes": {
@@ -3157,7 +2927,7 @@
"inputSchema": {
"properties": {
"id": {
"description": "主机 id,取 list_online_hosts / search_hosts 返回的 id 字段",
"description": "主机 id,取 list_hosts 返回的 id 字段",
"type": "string"
},
"local_path": {
@@ -3259,7 +3029,7 @@
"type": "array"
},
"src_id": {
"description": "源主机 id(文件从这里发出),取 list_online_hosts / search_hosts 返回的 id",
"description": "源主机 id(文件从这里发出),取 list_hosts 返回的 id",
"type": "string"
},
"timeout_ms": {
@@ -3325,7 +3095,7 @@
"type": "boolean"
},
"id": {
"description": "主机 id,取 list_online_hosts / search_hosts 返回的 id 字段",
"description": "主机 id,取 list_hosts 返回的 id 字段",
"type": "string"
},
"pids": {
@@ -3391,7 +3161,7 @@
"type": "integer"
},
"id": {
"description": "主机 id,取 list_online_hosts / search_hosts 返回的 id 字段",
"description": "主机 id,取 list_hosts 返回的 id 字段",
"type": "string"
}
},
@@ -3454,7 +3224,7 @@
"type": "string"
},
"id": {
"description": "主机 id,取 list_online_hosts / search_hosts 返回的 id 字段",
"description": "主机 id,取 list_hosts 返回的 id 字段",
"type": "string"
},
"service_name": {
@@ -3494,7 +3264,7 @@
"type": "string"
},
"id": {
"description": "主机 id,取 list_online_hosts / search_hosts 返回的 id 字段",
"description": "主机 id,取 list_hosts 返回的 id 字段",
"type": "string"
},
"wait": {
@@ -3553,7 +3323,7 @@
"inputSchema": {
"properties": {
"id": {
"description": "主机 id,取 list_online_hosts / search_hosts 返回的 id 字段",
"description": "主机 id,取 list_hosts 返回的 id 字段",
"type": "string"
},
"wait": {
@@ -3609,7 +3379,7 @@
"inputSchema": {
"properties": {
"id": {
"description": "主机 id(list_online_hosts / list_all_hosts 返回的十进制字符串)。",
"description": "主机 id(list_hosts 返回的十进制字符串)。",
"type": "string"
},
"remark": {