Feature(mcp): hide the degraded list_* tools when host management is on

host_inspect now covers processes, windows and services, so with
McpMachine=1 the older list_processes / list_windows / list_services
entries only competed with it: same intent, two names, two long
descriptions to read before choosing. They no longer appear in
tools/list while host management is enabled, but their names still
dispatch, so callers that cached them keep working.

They must stay visible when McpMachine=0: that is the default state and
the only way such a server can list processes, windows or services, so
the entries sit behind !IsMachineEnabled() rather than being removed.
list_network_connections is deliberately not folded in: it reads the
connection-manager view (IPv6 rows, killable flag, numeric state) which
host_inspect's IPv4-only network aspect does not provide.

tools.json is now generated from two captures, all-switches-on plus
McpMachine=0, because neither state contains the whole surface; the
off-state entries are marked gate "!machine" and verify_tools.py skips
them when comparing against an all-on server. tools/list went from 54
to 51 entries and from 183,336 B to 171,929 B (-6.2%).

Co-Authored-By: deepseek-flash
This commit is contained in:
yuanyuanxianganddeepseek-flash committed 2026-11-12 17:28:28 +01:00
1 parent 59f0f16f74
commit c73db530f4
4 files changed
+543 -488

No files matched your search

+471 -468
View File
@@ -5,6 +5,9 @@
"由 tools/mcp_tools/dump_tools.py 抓取、make_tools_json.py 生成,勿手工编辑。",
"gate: 该工具出现的开关条件(null = 无条件);write: 需 !McpReadonly;",
"manage: 额外需 McpManage。这三项从 C++ 注册点的 if 条件解析而来,运行时不可见。",
"gate 为 \"!machine\" 表示该降级工具只在 McpMachine=0 时出现(开启主机管理后",
"由 host_inspect 的对应 aspect 取代,名字仍可作为别名调用);清单是开启态与",
"关闭态两份抓取的并集。",
"platforms: 该工具涉及的任一主机都必须落在此集合内(win/lnx/mac/apk),依据各平台",
"客户端对相应 COMMAND_ 的处理实现。apk 上 COMMAND_SYSTEM 与 COMMAND_SHELL 均为空实现。",
"roles: 仅多主机工具才有。按参数名细分平台,表达 platforms 说不清的方向性能力",
@@ -358,322 +361,6 @@
"type": "object"
}
},
{
"name": "list_processes",
"description": "获取指定在线主机的进程列表(PID、映像名称、架构、程序完整路径)。通过主连接下发命令、子连接回传,一次性返回。可选 name(映像名子串,ASCII 不区分大小写)/ pid(精确)在服务端过滤,过滤在分页之前生效:total 为命中数、totalAll 为过滤前的总数。结果按 limit/offset 分页。定位是 McpMachine=0(主机管理工具关闭)时的降级路径,字段较少;若 host_inspect 出现在 tools/list 里,一律优先用它的 processes 项。",
"gate": null,
"platforms": [
"win",
"lnx",
"mac"
],
"impl": "mfc",
"inputSchema": {
"anyOf": [
{
"required": [
"id"
]
},
{
"required": [
"ids"
]
}
],
"properties": {
"id": {
"description": "主机 id,取 list_hosts 返回的 id 字段;与 ids 二选一",
"type": "string"
},
"ids": {
"description": "批量查询:一次传多台主机 id(最多 50 个),结果按台汇总在 results 里。与 id 二选一,仅只读工具支持;limit/offset 对每台主机各自生效。",
"items": {
"type": "string"
},
"type": "array"
},
"limit": {
"description": "本次最多返回的条数,默认 100,上限 1000。",
"type": "integer"
},
"name": {
"description": "按映像名子串过滤,ASCII 不区分大小写(如 chrome)",
"type": "string"
},
"offset": {
"description": "跳过前 N 条,默认 0;配合返回的 total/hasMore 翻页。",
"type": "integer"
},
"pid": {
"description": "按 PID 精确过滤",
"type": "integer"
}
},
"type": "object"
},
"outputSchema": {
"anyOf": [
{
"properties": {
"hasMore": {
"type": "boolean"
},
"limit": {
"type": "integer"
},
"offset": {
"type": "integer"
},
"processes": {
"items": {
"properties": {
"arch": {
"type": "string"
},
"name": {
"type": "string"
},
"path": {
"type": "string"
},
"pid": {
"type": "integer"
}
},
"type": "object"
},
"type": "array"
},
"total": {
"type": "integer"
},
"totalAll": {
"type": "integer"
}
},
"required": [
"processes"
],
"type": "object"
},
{
"properties": {
"failed": {
"description": "失败的台数",
"type": "integer"
},
"results": {
"items": {
"properties": {
"data": {
"description": "该台成功时的单机 structuredContent(字段随工具而定)",
"type": "object"
},
"error": {
"description": "该台失败时的错误对象(code / message)",
"type": "object"
},
"id": {
"description": "主机 id",
"type": "string"
},
"ok": {
"description": "该台是否成功",
"type": "boolean"
},
"text": {
"description": "该台失败时的错误文字",
"type": "string"
}
},
"type": "object"
},
"type": "array"
},
"skipped": {
"description": "因整体时限用尽而未下发的台数(不是主机侧错误)",
"type": "integer"
},
"succeeded": {
"description": "成功的台数",
"type": "integer"
},
"tool": {
"description": "被批量调用的工具名",
"type": "string"
},
"total": {
"description": "请求里的 id 台数",
"type": "integer"
}
},
"required": [
"results"
],
"type": "object"
}
],
"type": "object"
}
},
{
"name": "list_windows",
"description": "获取指定在线主机的顶层窗口列表(句柄、窗口标题、窗口状态、所属进程 PID)。一次性返回。可选 name(窗口标题子串,ASCII 不区分大小写)/ pid(所属进程,精确)在服务端过滤,过滤在分页之前生效:total 为命中数、totalAll 为过滤前的总数。结果按 limit/offset 分页。定位是 McpMachine=0(主机管理工具关闭)时的降级路径;若 host_inspect 出现在 tools/list 里,一律优先用它的 windows 项。",
"gate": null,
"platforms": [
"win"
],
"impl": "mfc",
"inputSchema": {
"anyOf": [
{
"required": [
"id"
]
},
{
"required": [
"ids"
]
}
],
"properties": {
"id": {
"description": "主机 id,取 list_hosts 返回的 id 字段;与 ids 二选一",
"type": "string"
},
"ids": {
"description": "批量查询:一次传多台主机 id(最多 50 个),结果按台汇总在 results 里。与 id 二选一,仅只读工具支持;limit/offset 对每台主机各自生效。",
"items": {
"type": "string"
},
"type": "array"
},
"limit": {
"description": "本次最多返回的条数,默认 100,上限 1000。",
"type": "integer"
},
"name": {
"description": "按窗口标题子串过滤,ASCII 不区分大小写(如 notepad);匹配的是标题不是进程名",
"type": "string"
},
"offset": {
"description": "跳过前 N 条,默认 0;配合返回的 total/hasMore 翻页。",
"type": "integer"
},
"pid": {
"description": "按窗口所属进程的 PID 精确过滤",
"type": "integer"
}
},
"type": "object"
},
"outputSchema": {
"anyOf": [
{
"properties": {
"hasMore": {
"type": "boolean"
},
"limit": {
"type": "integer"
},
"offset": {
"type": "integer"
},
"total": {
"type": "integer"
},
"totalAll": {
"type": "integer"
},
"windows": {
"items": {
"properties": {
"hwnd": {
"type": "integer"
},
"pid": {
"type": "integer"
},
"status": {
"type": "string"
},
"title": {
"type": "string"
}
},
"type": "object"
},
"type": "array"
}
},
"required": [
"windows"
],
"type": "object"
},
{
"properties": {
"failed": {
"description": "失败的台数",
"type": "integer"
},
"results": {
"items": {
"properties": {
"data": {
"description": "该台成功时的单机 structuredContent(字段随工具而定)",
"type": "object"
},
"error": {
"description": "该台失败时的错误对象(code / message)",
"type": "object"
},
"id": {
"description": "主机 id",
"type": "string"
},
"ok": {
"description": "该台是否成功",
"type": "boolean"
},
"text": {
"description": "该台失败时的错误文字",
"type": "string"
}
},
"type": "object"
},
"type": "array"
},
"skipped": {
"description": "因整体时限用尽而未下发的台数(不是主机侧错误)",
"type": "integer"
},
"succeeded": {
"description": "成功的台数",
"type": "integer"
},
"tool": {
"description": "被批量调用的工具名",
"type": "string"
},
"total": {
"description": "请求里的 id 台数",
"type": "integer"
}
},
"required": [
"results"
],
"type": "object"
}
],
"type": "object"
}
},
{
"name": "get_activity_history",
"description": "获取指定在线主机的历史活动记录。Windows 与有桌面的 Linux 客户端返回前台窗口驻留记录,每行一条「[时间] [标题] 时长」;Android 客户端返回前台应用驻留记录(标题为「应用名 (包名)」,需开启无障碍服务);无桌面的 Linux 客户端返回登录记录与 shell 命令历史,每行带「[登录]」或「[命令]」标签(首行为「[来源]」说明)。主连接 RPC。结果按 limit/offset 分页(默认 100 条、上限 1000),新在前:offset=0 就是最近 limit 条,想看更早的再往后翻。total 为本机现有记录总数,hasMore 表示还有更早的记录;窗口后端只保留最近 500 条,所以 total 最多约 501(含进行中的当前窗口)。",
@@ -1193,158 +880,6 @@
"type": "object"
}
},
{
"name": "list_services",
"description": "获取指定在线 Windows 主机的服务列表(显示名、服务名、可执行文件路径、运行状态、启动类型)。仅 Windows 客户端支持;一次性返回,结果按 limit/offset 分页。不支持服务端过滤。定位是 McpMachine=0(主机管理工具关闭)时的降级路径,字段较少(无描述、登录身份);若 host_inspect 出现在 tools/list 里,一律优先用它的 win32_services 项。",
"gate": null,
"platforms": [
"win"
],
"impl": "mfc",
"inputSchema": {
"anyOf": [
{
"required": [
"id"
]
},
{
"required": [
"ids"
]
}
],
"properties": {
"id": {
"description": "主机 id,取 list_hosts 返回的 id 字段;与 ids 二选一",
"type": "string"
},
"ids": {
"description": "批量查询:一次传多台主机 id(最多 50 个),结果按台汇总在 results 里。与 id 二选一,仅只读工具支持;limit/offset 对每台主机各自生效。",
"items": {
"type": "string"
},
"type": "array"
},
"limit": {
"description": "本次最多返回的条数,默认 100,上限 1000。",
"type": "integer"
},
"offset": {
"description": "跳过前 N 条,默认 0;配合返回的 total/hasMore 翻页。",
"type": "integer"
}
},
"type": "object"
},
"outputSchema": {
"anyOf": [
{
"properties": {
"hasMore": {
"type": "boolean"
},
"limit": {
"type": "integer"
},
"offset": {
"type": "integer"
},
"services": {
"items": {
"properties": {
"binary_path": {
"type": "string"
},
"display_name": {
"type": "string"
},
"service_name": {
"type": "string"
},
"start_type": {
"type": "string"
},
"status": {
"type": "string"
}
},
"type": "object"
},
"type": "array"
},
"total": {
"type": "integer"
},
"totalAll": {
"type": "integer"
}
},
"required": [
"services"
],
"type": "object"
},
{
"properties": {
"failed": {
"description": "失败的台数",
"type": "integer"
},
"results": {
"items": {
"properties": {
"data": {
"description": "该台成功时的单机 structuredContent(字段随工具而定)",
"type": "object"
},
"error": {
"description": "该台失败时的错误对象(code / message)",
"type": "object"
},
"id": {
"description": "主机 id",
"type": "string"
},
"ok": {
"description": "该台是否成功",
"type": "boolean"
},
"text": {
"description": "该台失败时的错误文字",
"type": "string"
}
},
"type": "object"
},
"type": "array"
},
"skipped": {
"description": "因整体时限用尽而未下发的台数(不是主机侧错误)",
"type": "integer"
},
"succeeded": {
"description": "成功的台数",
"type": "integer"
},
"tool": {
"description": "被批量调用的工具名",
"type": "string"
},
"total": {
"description": "请求里的 id 台数",
"type": "integer"
}
},
"required": [
"results"
],
"type": "object"
}
],
"type": "object"
}
},
{
"name": "get_client_log",
"description": "获取指定在线主机 YAMA 客户端的内存运行日志(客户端 ring buffer,最多 1000 行,含时间戳/源文件/行号)。注意:这不是被管业务程序的日志——业务程序自己写的日志在主机磁盘上,读它用 read_file(看尾部用 offset=-N,如 offset=-200)。本工具取的是 YAMA 客户端自身的运行记录,用于排查客户端/连接问题。客户端持续增量上报,本工具取当前时刻的快照后即断开。默认只返回末尾 200 行(故障排查看的是最后发生了什么);可用 limit 调整(上限 2000)、filter 只保留包含某子串的行。返回里的 lines_total / lines_matched / lines_returned / truncated 说明裁剪情况。只读。",
@@ -5374,6 +4909,474 @@
],
"type": "object"
}
},
{
"name": "list_processes",
"description": "获取指定在线主机的进程列表(PID、映像名称、架构、程序完整路径)。通过主连接下发命令、子连接回传,一次性返回。可选 name(映像名子串,ASCII 不区分大小写)/ pid(精确)在服务端过滤,过滤在分页之前生效:total 为命中数、totalAll 为过滤前的总数。结果按 limit/offset 分页。仅在 McpMachine=0(主机管理工具关闭)时出现——那是本服务端唯一能列进程的路径;开启主机管理后改用 host_inspect 的 processes 项(字段更全、支持 arch 过滤)。",
"gate": "!machine",
"platforms": [
"win",
"lnx",
"mac"
],
"impl": "mfc",
"inputSchema": {
"anyOf": [
{
"required": [
"id"
]
},
{
"required": [
"ids"
]
}
],
"properties": {
"id": {
"description": "主机 id,取 list_hosts 返回的 id 字段;与 ids 二选一",
"type": "string"
},
"ids": {
"description": "批量查询:一次传多台主机 id(最多 50 个),结果按台汇总在 results 里。与 id 二选一,仅只读工具支持;limit/offset 对每台主机各自生效。",
"items": {
"type": "string"
},
"type": "array"
},
"limit": {
"description": "本次最多返回的条数,默认 100,上限 1000。",
"type": "integer"
},
"name": {
"description": "按映像名子串过滤,ASCII 不区分大小写(如 chrome)",
"type": "string"
},
"offset": {
"description": "跳过前 N 条,默认 0;配合返回的 total/hasMore 翻页。",
"type": "integer"
},
"pid": {
"description": "按 PID 精确过滤",
"type": "integer"
}
},
"type": "object"
},
"outputSchema": {
"anyOf": [
{
"properties": {
"hasMore": {
"type": "boolean"
},
"limit": {
"type": "integer"
},
"offset": {
"type": "integer"
},
"processes": {
"items": {
"properties": {
"arch": {
"type": "string"
},
"name": {
"type": "string"
},
"path": {
"type": "string"
},
"pid": {
"type": "integer"
}
},
"type": "object"
},
"type": "array"
},
"total": {
"type": "integer"
},
"totalAll": {
"type": "integer"
}
},
"required": [
"processes"
],
"type": "object"
},
{
"properties": {
"failed": {
"description": "失败的台数",
"type": "integer"
},
"results": {
"items": {
"properties": {
"data": {
"description": "该台成功时的单机 structuredContent(字段随工具而定)",
"type": "object"
},
"error": {
"description": "该台失败时的错误对象(code / message)",
"type": "object"
},
"id": {
"description": "主机 id",
"type": "string"
},
"ok": {
"description": "该台是否成功",
"type": "boolean"
},
"text": {
"description": "该台失败时的错误文字",
"type": "string"
}
},
"type": "object"
},
"type": "array"
},
"skipped": {
"description": "因整体时限用尽而未下发的台数(不是主机侧错误)",
"type": "integer"
},
"succeeded": {
"description": "成功的台数",
"type": "integer"
},
"tool": {
"description": "被批量调用的工具名",
"type": "string"
},
"total": {
"description": "请求里的 id 台数",
"type": "integer"
}
},
"required": [
"results"
],
"type": "object"
}
],
"type": "object"
}
},
{
"name": "list_windows",
"description": "获取指定在线主机的顶层窗口列表(句柄、窗口标题、窗口状态、所属进程 PID)。一次性返回。可选 name(窗口标题子串,ASCII 不区分大小写)/ pid(所属进程,精确)在服务端过滤,过滤在分页之前生效:total 为命中数、totalAll 为过滤前的总数。结果按 limit/offset 分页。仅在 McpMachine=0(主机管理工具关闭)时出现;开启主机管理后改用 host_inspect 的 windows 项(字段更全,含窗口矩形与 z 序)。",
"gate": "!machine",
"platforms": [
"win"
],
"impl": "mfc",
"inputSchema": {
"anyOf": [
{
"required": [
"id"
]
},
{
"required": [
"ids"
]
}
],
"properties": {
"id": {
"description": "主机 id,取 list_hosts 返回的 id 字段;与 ids 二选一",
"type": "string"
},
"ids": {
"description": "批量查询:一次传多台主机 id(最多 50 个),结果按台汇总在 results 里。与 id 二选一,仅只读工具支持;limit/offset 对每台主机各自生效。",
"items": {
"type": "string"
},
"type": "array"
},
"limit": {
"description": "本次最多返回的条数,默认 100,上限 1000。",
"type": "integer"
},
"name": {
"description": "按窗口标题子串过滤,ASCII 不区分大小写(如 notepad);匹配的是标题不是进程名",
"type": "string"
},
"offset": {
"description": "跳过前 N 条,默认 0;配合返回的 total/hasMore 翻页。",
"type": "integer"
},
"pid": {
"description": "按窗口所属进程的 PID 精确过滤",
"type": "integer"
}
},
"type": "object"
},
"outputSchema": {
"anyOf": [
{
"properties": {
"hasMore": {
"type": "boolean"
},
"limit": {
"type": "integer"
},
"offset": {
"type": "integer"
},
"total": {
"type": "integer"
},
"totalAll": {
"type": "integer"
},
"windows": {
"items": {
"properties": {
"hwnd": {
"type": "integer"
},
"pid": {
"type": "integer"
},
"status": {
"type": "string"
},
"title": {
"type": "string"
}
},
"type": "object"
},
"type": "array"
}
},
"required": [
"windows"
],
"type": "object"
},
{
"properties": {
"failed": {
"description": "失败的台数",
"type": "integer"
},
"results": {
"items": {
"properties": {
"data": {
"description": "该台成功时的单机 structuredContent(字段随工具而定)",
"type": "object"
},
"error": {
"description": "该台失败时的错误对象(code / message)",
"type": "object"
},
"id": {
"description": "主机 id",
"type": "string"
},
"ok": {
"description": "该台是否成功",
"type": "boolean"
},
"text": {
"description": "该台失败时的错误文字",
"type": "string"
}
},
"type": "object"
},
"type": "array"
},
"skipped": {
"description": "因整体时限用尽而未下发的台数(不是主机侧错误)",
"type": "integer"
},
"succeeded": {
"description": "成功的台数",
"type": "integer"
},
"tool": {
"description": "被批量调用的工具名",
"type": "string"
},
"total": {
"description": "请求里的 id 台数",
"type": "integer"
}
},
"required": [
"results"
],
"type": "object"
}
],
"type": "object"
}
},
{
"name": "list_services",
"description": "获取指定在线 Windows 主机的服务列表(显示名、服务名、可执行文件路径、运行状态、启动类型)。仅 Windows 客户端支持;一次性返回,结果按 limit/offset 分页。不支持服务端过滤。仅在 McpMachine=0(主机管理工具关闭)时出现;开启主机管理后改用 host_inspect 的 win32_services 项(字段更全:描述、登录身份)。注意两者都要求客户端以管理员权限运行,否则拿不到服务列表。",
"gate": "!machine",
"platforms": [
"win"
],
"impl": "mfc",
"inputSchema": {
"anyOf": [
{
"required": [
"id"
]
},
{
"required": [
"ids"
]
}
],
"properties": {
"id": {
"description": "主机 id,取 list_hosts 返回的 id 字段;与 ids 二选一",
"type": "string"
},
"ids": {
"description": "批量查询:一次传多台主机 id(最多 50 个),结果按台汇总在 results 里。与 id 二选一,仅只读工具支持;limit/offset 对每台主机各自生效。",
"items": {
"type": "string"
},
"type": "array"
},
"limit": {
"description": "本次最多返回的条数,默认 100,上限 1000。",
"type": "integer"
},
"offset": {
"description": "跳过前 N 条,默认 0;配合返回的 total/hasMore 翻页。",
"type": "integer"
}
},
"type": "object"
},
"outputSchema": {
"anyOf": [
{
"properties": {
"hasMore": {
"type": "boolean"
},
"limit": {
"type": "integer"
},
"offset": {
"type": "integer"
},
"services": {
"items": {
"properties": {
"binary_path": {
"type": "string"
},
"display_name": {
"type": "string"
},
"service_name": {
"type": "string"
},
"start_type": {
"type": "string"
},
"status": {
"type": "string"
}
},
"type": "object"
},
"type": "array"
},
"total": {
"type": "integer"
},
"totalAll": {
"type": "integer"
}
},
"required": [
"services"
],
"type": "object"
},
{
"properties": {
"failed": {
"description": "失败的台数",
"type": "integer"
},
"results": {
"items": {
"properties": {
"data": {
"description": "该台成功时的单机 structuredContent(字段随工具而定)",
"type": "object"
},
"error": {
"description": "该台失败时的错误对象(code / message)",
"type": "object"
},
"id": {
"description": "主机 id",
"type": "string"
},
"ok": {
"description": "该台是否成功",
"type": "boolean"
},
"text": {
"description": "该台失败时的错误文字",
"type": "string"
}
},
"type": "object"
},
"type": "array"
},
"skipped": {
"description": "因整体时限用尽而未下发的台数(不是主机侧错误)",
"type": "integer"
},
"succeeded": {
"description": "成功的台数",
"type": "integer"
},
"tool": {
"description": "被批量调用的工具名",
"type": "string"
},
"total": {
"description": "请求里的 id 台数",
"type": "integer"
}
},
"required": [
"results"
],
"type": "object"
}
],
"type": "object"
}
}
]
}