[ { "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)。", "inputSchema": { "properties": { "client_type": { "description": "按客户端类型过滤(子串,不区分大小写,如 EXE、LNX、MAC)。离线主机没有该字段,不会命中。省略则不过滤。", "type": "string" }, "group": { "description": "按分组过滤(子串,不区分大小写)。省略则不过滤。", "type": "string" }, "include_offline": { "description": "是否把离线主机一起返回,默认 false(只给在线);online=false 时无意义。list_all_hosts 别名默认 true。", "type": "boolean" }, "ip": { "description": "只按 IP 过滤(search_hosts 的旧参数);与 query 同时给出时两者都需满足。", "type": "string" }, "limit": { "description": "本次最多返回的条数,默认 100,上限 1000。", "type": "integer" }, "name": { "description": "只按计算机名/备注过滤(search_hosts 的旧参数);与 query 同时给出时两者都需满足。", "type": "string" }, "offset": { "description": "跳过前 N 条,默认 0;配合返回的 total/hasMore 翻页。", "type": "integer" }, "online": { "description": "true(默认)返回在线主机;false 只返回离线主机(历史连接过、当前未连接)。", "type": "boolean" }, "os": { "description": "按操作系统过滤(子串,不区分大小写,如 Windows、Linux、Android)。省略则不过滤。", "type": "string" }, "query": { "description": "关键字:子串匹配计算机名、备注或 IP(ASCII 不区分大小写)。省略则不过滤。", "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": "get_host_detail", "description": "获取单台在线主机的详细信息(id、计算机名、IP、操作系统、备注、分组、活动窗口、屏幕分辨率、客户端类型等)。tls=true 表示该客户端登录时使用了 TLS 加密传输(登录时上报,老客户端恒为 false)。", "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" } }, "type": "object" }, "outputSchema": { "anyOf": [ { "properties": { "host": { "properties": { "activeWindow": { "type": "string" }, "authStatus": { "type": "string" }, "capabilities": { "properties": { "c2cPaths": { "description": "能否按路径清单接收另一台主机的文件(copy_files_c2c 源端的前提)", "type": "boolean" }, "fileTransferV2": { "description": "是否支持 V2 文件传输(download_file / upload_file 的前提)", "type": "boolean" }, "platform": { "description": "客户端形态:EXE/DLL/MEXE/SC/MDLL(Windows)、LNX(Linux)、MAC、APK", "type": "string" }, "registry": { "description": "是否有 Windows 注册表可查(list_registry);仅 Windows 客户端为 true", "type": "boolean" }, "remoteControl": { "description": "能否建立远程控制会话(remote_open/remote_mouse/remote_keyboard 的前提);Android 客户端只支持整屏目标,且需要已授权录屏与无障碍服务;还要求服务端 Web 远程服务已启动(WebSvrPort>0)", "type": "boolean" }, "screenPreview": { "description": "能否截屏(get_screenshot 的前提)", "type": "boolean" }, "screenRegion": { "description": "能否按区域/窗口/显示器原生分辨率截屏(get_screenshot 的 mode=region/window/monitor 前提);仅声明 CLIENT_CAP_SCREEN_REGION 的新 Windows 客户端为 true", "type": "boolean" }, "windowInfo": { "description": "是否支持窗口信息(get_foreground_window、host_inspect 的 windows 项坐标/前后台字段、operate_window/host_control_window 的 activate);仅声明 CLIENT_CAP_WINDOW_INFO 的新客户端为 true", "type": "boolean" } }, "type": "object" }, "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" } }, "required": [ "host" ], "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_screenshot", "description": "截取指定在线主机的一帧画面,返回 base64 编码的 JPEG 图片:图片在 content 的 image 块(data 为 base64,mimeType=image/jpeg);structuredContent.image 只有 mimeType/width/height/bytes 元数据,不含图片数据。支持 Windows 与带 X11 桌面的 Linux 客户端(能力位 CLIENT_CAP_SCREEN_PREVIEW),主连接 RPC、一次性返回。Android 客户端用无障碍服务 takeScreenshot 抓屏(Android 11+ 且开启无障碍服务,此时登录会声明该能力位;只支持 mode=screen)。mode 可选 screen(默认,整虚拟桌面)/region(指定矩形)/window(指定 hwnd)/monitor(指定显示器);后三种默认按源尺寸 1:1 原生分辨率抓取(适合 OCR/视觉读字),需要较新的 Windows 客户端(CLIENT_CAP_SCREEN_REGION,否则 -32005),结果在 structuredContent.capture 里回报实际源矩形与缩放比例。", "inputSchema": { "allOf": [ { "if": { "properties": { "mode": { "enum": [ "region" ] } }, "required": [ "mode" ] }, "then": { "required": [ "width", "height" ] } }, { "if": { "properties": { "mode": { "enum": [ "window" ] } }, "required": [ "mode" ] }, "then": { "required": [ "hwnd" ] } } ], "properties": { "height": { "description": "region 模式必填:矩形高度(像素,1~8192)。超出虚拟桌面的部分会被裁剪。", "type": "integer" }, "hwnd": { "description": "window 模式必填:窗口句柄(整数或 0x 前缀字符串),取 host_inspect 的 windows 项 / get_foreground_window 返回的 hwnd。窗口最小化时无法抓取(返回错误),先 activate/restore。", "type": [ "integer", "string" ] }, "id": { "description": "主机 id,取 list_hosts 返回的 id 字段", "type": "string" }, "max_width": { "description": "期望图片最大宽度(像素,钳制到 64~1920)。screen 模式省略或传 0 时沿用 RTT 自适应缩略图档位(最大 1024);region/window/monitor 模式省略/传 0 时按源尺寸 1:1 抓取(原生分辨率),显式传入才等比缩小。", "type": "integer" }, "mode": { "description": "抓取范围,默认 screen。screen=整个虚拟桌面(可缩放);region=指定矩形;window=指定窗口;monitor=指定显示器。region/window/monitor 默认按源尺寸 1:1 抓取(原生分辨率,适合 OCR/视觉读字),只有显式传 max_width 才缩放;这三种需要较新的 Windows 客户端(能力位 CLIENT_CAP_SCREEN_REGION),否则返回 -32005。", "enum": [ "screen", "region", "window", "monitor" ], "type": "string" }, "monitor": { "description": "monitor 模式:显示器序号,0=主显示器(默认),1..N 为其余显示器(按系统枚举顺序)。序号越界返回错误。", "type": "integer" }, "width": { "description": "region 模式必填:矩形宽度(像素,1~8192)。超出虚拟桌面的部分会被裁剪。", "type": "integer" }, "x": { "description": "region 模式:矩形左上角的虚拟桌面 X 坐标(可为负;多显示器时以虚拟桌面左上角为原点)。省略按 0 处理。", "type": "integer" }, "y": { "description": "region 模式:矩形左上角的虚拟桌面 Y 坐标(可为负)。省略按 0 处理。", "type": "integer" } }, "required": [ "id" ], "type": "object" }, "outputSchema": { "properties": { "capture": { "properties": { "height": { "type": "integer" }, "mode": { "type": "string" }, "native": { "type": "boolean" }, "scale": { "type": "integer" }, "width": { "type": "integer" }, "x": { "type": "integer" }, "y": { "type": "integer" } }, "type": "object" }, "image": { "properties": { "bytes": { "type": "integer" }, "height": { "type": "integer" }, "mimeType": { "type": "string" }, "width": { "type": "integer" } }, "type": "object" } }, "required": [ "image" ], "type": "object" } }, { "name": "list_files", "description": "列举指定在线主机的目录。省略或空 path 返回驱动器列表(drives);给定 path 返回该目录一层内的文件/子目录(files,含 name/isDir/size/mtime),整目录解析后按 limit/offset 分页(默认 100 条、上限 1000 条,total/hasMore 是真实的目录条目数;目录超过 10 万条时按上限截断并返回 truncated=true)。Windows 上 \".\"/\"/\"/\"\\\\\" 视同省略 path;Linux/macOS 上 \"/\" 是根目录。只读。", "inputSchema": { "anyOf": [ { "required": [ "id" ] }, { "required": [ "ids" ] } ], "properties": { "id": { "description": "主机 id,取 list_hosts 返回的 id 字段", "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" }, "path": { "description": "要列举的目录路径(如 C:\\Windows 或 /etc)。省略或传空返回驱动器列表;Windows 上 \".\"、\"/\"、\"\\\\\" 视同省略;Linux/macOS 上 \"/\" 是根目录,按真实目录列举。", "type": "string" } }, "type": "object" }, "outputSchema": { "anyOf": [ { "properties": { "drives": { "items": { "properties": { "drive": { "type": "string" }, "fileSystem": { "type": "string" }, "freeMB": { "type": "integer" }, "totalMB": { "type": "integer" }, "type": { "type": "integer" }, "typeName": { "type": "string" } }, "type": "object" }, "type": "array" }, "files": { "items": { "properties": { "isDir": { "type": "boolean" }, "mtime": { "type": "integer" }, "name": { "type": "string" }, "size": { "type": "integer" } }, "type": "object" }, "type": "array" }, "hasMore": { "type": "boolean" }, "limit": { "type": "integer" }, "offset": { "type": "integer" }, "total": { "type": "integer" }, "totalAll": { "type": "integer" }, "truncated": { "description": "目录条目超过服务端解析上限(100000 条)时为 true;仅在返回 files 时可能出现,此时 total 不是真实总数。", "type": "boolean" } }, "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_audit_log", "description": "获取 YAMA 服务端主界面的消息/审计日志(主机上线/下线、操作结果、告警等),按 limit/offset 分页(新在前,服务端只保留最近 1000 条)。可选 type 按类型列做不区分大小写的子串过滤(如 MCP、主机),keyword 按正文字串过滤;过滤在分页之前生效,total 为命中条数、totalAll 为镜像里的全部条数。只读、纯内存。", "inputSchema": { "properties": { "keyword": { "description": "正文子串过滤,不区分大小写(如 445、timeout)。省略则不过滤。", "type": "string" }, "limit": { "description": "本次最多返回的条数,默认 100,上限 1000。", "type": "integer" }, "offset": { "description": "跳过前 N 条,默认 0;配合返回的 total/hasMore 翻页。", "type": "integer" }, "type": { "description": "类型列的子串过滤,不区分大小写(如 MCP、主机上线)。省略则不过滤。", "type": "string" } }, "required": [], "type": "object" }, "outputSchema": { "properties": { "entries": { "items": { "properties": { "msg": { "type": "string" }, "time": { "type": "string" }, "type": { "type": "string" } }, "type": "object" }, "type": "array" }, "hasMore": { "type": "boolean" }, "limit": { "type": "integer" }, "offset": { "type": "integer" }, "total": { "type": "integer" }, "totalAll": { "type": "integer" } }, "required": [ "entries" ], "type": "object" } }, { "name": "get_server_status", "description": "获取 YAMA 服务端自身的状态:程序版本与 exe 构建时间、进程已运行秒数、MCP 监听地址与端口、各功能开关(只读/终端/远程控制/文件传输/管理/主机管理/高风险操作/键盘记录/远程交谈)、在线与离线主机数、各类在飞会话数、当前被封禁的来源 IP 数。只读、纯内存,不返回 token。", "inputSchema": { "properties": {}, "required": [], "type": "object" }, "outputSchema": { "properties": { "app_name": { "type": "string" }, "bind": { "type": "string" }, "blocked_auth_ips": { "type": "integer" }, "exe_build_time": { "type": "string" }, "hosts": { "type": "object" }, "port": { "type": "integer" }, "sessions": { "type": "object" }, "switches": { "type": "object" }, "uptime_sec": { "type": "integer" }, "version": { "type": "string" } }, "required": [], "type": "object" } }, { "name": "terminal_exec", "description": "在已打开的持久会话中执行一条命令,或轮询取回正在运行的命令输出。带 command 时执行并在 timeout_ms 内等待;等待超时返回 done:false 与已产生的部分输出,会话不销毁(命令仍在远端运行)。session_id 可省略:自动复用该主机已有的持久会话,没有就隐式打开一个(结果里有 session_id 与 reused),不必先 terminal_open。不带 command、只传 session_id 时进入轮询模式:继续等待并取回增量输出,直到 done:true(此时有 exit_code)。命令不受白名单约束。PTY 会话(新 Windows 客户端 ConPTY / Linux 与新版 Android 的 POSIX PTY)下可用管道 | 与 && / || 串联,退出码取整条管道/串联,适合「ls -1 | wc -l」这类先过滤再回传的用法;不要用后台执行符 &(POSIX)或换行。老非 PTY Windows 客户端仍不支持 & 与 |,请拆成多条调用。", "inputSchema": { "anyOf": [ { "required": [ "command" ] }, { "required": [ "session_id" ] } ], "properties": { "command": { "description": "要执行的命令(完整 shell,不受白名单约束)。省略时进入轮询模式:不执行新命令,只等待并取回当前会话的增量输出(上一条命令超时后用这个方式继续取)。PTY 会话(Windows ConPTY / Linux PTY)下可用管道 | 与 && / || 串联,退出码取整条管道/串联;不要用后台执行符 &(POSIX)或换行。老非 PTY 客户端仍不支持 & 与 |,请拆成多条调用。Linux 下通过 POSIX shell 执行,可用 ; 串联且退出码取最后一条命令", "type": "string" }, "id": { "description": "主机 id,取 list_hosts 返回的 id 字段", "type": "string" }, "max_output_bytes": { "description": "单次返回的原始输出上限(可选,默认 65536,最小 1024,最大 1048576);超出按换行边界截断并置 truncated:true,再轮询一次可取回剩余", "type": "integer" }, "session_id": { "description": "会话 token。带 command 时可省略:自动复用该主机已有的持久会话,没有就在内部打开一个(结果里有 session_id 与 reused)。轮询模式必须提供", "type": "string" }, "timeout_ms": { "description": "本次调用最多等待的毫秒数(可选,默认 20000,上限 600000)。等待超时不算失败:返回 done:false 与已产生的输出,命令仍在远端运行,继续轮询即可", "type": "integer" } }, "required": [ "id" ], "type": "object" }, "outputSchema": { "properties": { "done": { "description": "false=命令仍在运行,用同一工具只传 session_id 继续取增量;true=命令已结束,exit_code 有效", "type": "boolean" }, "dropped_bytes": { "description": "因单条命令输出超过 8MB 上限被丢弃的最旧字节数(该命令累计,0 或省略=无丢失)", "type": "integer" }, "elapsed_ms": { "description": "本次调用实际等待的毫秒数", "type": "integer" }, "exit_code": { "description": "退出码(done=true 时提供):PTY 客户端(Windows ConPTY / Linux PTY)为命令的真实退出码;老客户端(非 PTY)仅区分 0/非 0;-1=未知(shell 进程退出)", "type": "integer" }, "is_pty": { "description": "true=PTY(UTF-8)(Windows ConPTY / Linux PTY);false=老 cmd 管道(GBK)", "type": "boolean" }, "reused": { "description": "true=复用了该主机已有的持久会话;false=本次隐式新建(省略 session_id 时)", "type": "boolean" }, "session_id": { "description": "会话 token,原样回传,便于续接轮询", "type": "string" }, "stdout": { "description": "本次新增的输出(已剥哨兵与 ANSI 转义)", "type": "string" }, "truncated": { "description": "true=本次受 max_output_bytes 限制仍有剩余输出,立即再轮询即可取回", "type": "boolean" } }, "required": [ "stdout", "done", "session_id" ], "type": "object" } }, { "name": "terminal_close", "description": "关闭并释放指定持久会话(幂等:会话已不存在也返回成功)。", "inputSchema": { "properties": { "id": { "description": "主机 id,取 list_hosts 返回的 id 字段", "type": "string" }, "session_id": { "description": "terminal_open 返回的 session_id", "type": "string" } }, "required": [ "id", "session_id" ], "type": "object" }, "outputSchema": { "properties": { "closed": { "description": "恒为 true(关闭幂等)", "type": "boolean" } }, "required": [ "closed" ], "type": "object" } }, { "name": "read_file", "description": "按字节读取指定在线主机上的一个文本文件(分页 + 编码识别 + 整文件 SHA-256),只支持单个普通文件。path 为远程绝对路径:Windows 用 D:\\cfg\\app.ini 这类盘符路径,Linux/macOS 用 /etc/app.conf 这类 POSIX 路径。offset 支持负数(-200 = 最后 200 行,看日志尾部);limit 为最多返回的行数(默认 2000);encoding=auto 时按 BOM → UTF-8 合法性 → GBK 回退识别,也可显式传 utf-8 / gbk / latin1;max_bytes 限制本次返回的文本字节数(默认 262144=256KB,超出按 truncated=true 截断)。目录、或大于 2MB 的文件返回 -32602(请改用 download_file)。返回 size/encoding/eol/lines_total/offset/lines_returned/truncated/text/sha256(sha256 是整个文件,不是本次片段)。读配置文件/日志时用它,不要用 exec_command 的 type/Get-Content(GBK 会乱码、行尾会被归一化);看被管业务程序的日志尾部用 offset=-N(如 offset=-200,N 为行数)。", "inputSchema": { "properties": { "encoding": { "description": "auto(默认,按 BOM → UTF-8 合法性 → GBK 回退)/ utf-8 / gbk / gb18030 / latin1", "type": "string" }, "id": { "description": "主机 id,取 list_hosts 返回的 id 字段", "type": "string" }, "limit": { "description": "最多返回的行数(1..200000,默认 2000)", "type": "integer" }, "max_bytes": { "description": "本次返回文本的字节上限(1024..2097152,默认 262144=256KB),超出按 truncated=true 截断", "type": "integer" }, "offset": { "description": "起始行(0 基)。负数表示从末尾倒数:-200 = 最后 200 行;默认 0", "type": "integer" }, "path": { "description": "远程文件的绝对路径。Windows 用 D:\\cfg\\app.ini 这类盘符路径;Linux/macOS 用 /etc/app.conf 这类 POSIX 路径。必须是单个普通文件(目录或大于 2MB 的文件返回 -32602)", "type": "string" } }, "required": [ "id", "path" ], "type": "object" }, "outputSchema": { "properties": { "encoding": { "description": "实际使用的编码:utf-8 / utf-16le / utf-16be / gbk / gb18030 / latin1", "type": "string" }, "eol": { "description": "行尾风格:crlf / lf / cr / mixed / none", "type": "string" }, "lines_returned": { "description": "本次返回的行数", "type": "integer" }, "lines_total": { "description": "文件总行数(末尾换行不计空行)", "type": "integer" }, "offset": { "description": "本次实际起始行(负数已换算成绝对行号)", "type": "integer" }, "path": { "description": "远程路径(原样回传)", "type": "string" }, "sha256": { "description": "整个文件的 SHA-256(不是本次片段),可与 download_file 的结果比对", "type": "string" }, "size": { "description": "文件总字节数", "type": "integer" }, "text": { "description": "文件内容(UTF-8,行以 \\n 分隔,已去掉 BOM)", "type": "string" }, "truncated": { "description": "true=还有内容没返回(超出 limit / max_bytes),可调整 offset 继续读", "type": "boolean" } }, "required": [ "path", "size", "encoding", "eol", "lines_total", "offset", "lines_returned", "truncated", "text", "sha256" ], "type": "object" } } ]