Feature(mcp): merge the ten host_list_* tools into host_inspect
The ten read-only host-management tools (host_list_processes, windows, network_state, software, browser_history, favorites, win32_services, driver_services, scheduled_tasks, host_get_hosts_file) each carried a name, description and schema for what is one connection to the host, one tab id per aspect and one paged list shape. Ten entries made tools/list hard to scan and took a large share of the description budget. They are now one tool, host_inspect(aspects[], ...), where aspects is a required, deduplicated array of the ten former names. A single aspect returns exactly what the old tool returned (same builder, same code path), so output is byte-identical; several aspects are fetched over separate managed sessions and merged into results.<aspect>, with failures isolated in errors.<aspect> and isError only when every aspect failed. Filters (pid/name/arch/title/url/publisher/folder/status/ start_type/process/protocol/ports/state/max_bytes) are still applied server-side before paging and are ignored by aspects they don't apply to. The old names stay as dispatch aliases so existing callers keep working but no longer appear in tools/list; the platform table, batch read-only list, tool hints, instructions, generator tables and the captured mcp/tools.json move to the new name (63 tools -> 54). The description also notes that win32_services / driver_services need an elevated client: a non-elevated one cannot open SCM and never answers, so the call times out after ~12 s. Co-Authored-By: deepseek-flash
This commit is contained in:
1 parent
cac5adaafc
commit
59f0f16f74
5 files changed
+1034
-1803
No files matched your search
+698
-1636
File diff suppressed because it is too large.
Load diff
@@ -510,6 +510,8 @@ const ToolHints kToolHints[] = {
|
||||
{ "move_path", false, true, false, true },
|
||||
{ "create_folder", false, false, true, true }, // 已存在时同样成功
|
||||
{ "list_network_connections", true, false, true, true },
|
||||
// P2-1:10 个 host_list_* 合并为 host_inspect(旧名为别名,行为一致)
|
||||
{ "host_inspect", true, false, true, true },
|
||||
{ "host_list_processes", true, false, true, true },
|
||||
{ "host_list_windows", true, false, true, true },
|
||||
{ "host_list_network_state", true, false, true, true },
|
||||
@@ -596,6 +598,7 @@ bool IsBatchReadOnlyTool(const std::string& t) {
|
||||
"get_host_detail", "list_processes", "list_windows", "list_services",
|
||||
"list_files", "list_registry", "get_client_log", "get_activity_history",
|
||||
"list_network_connections",
|
||||
"host_inspect", // P2-1:10 个 host_list_* 合并后的入口
|
||||
"host_list_processes", "host_list_windows", "host_list_network_state",
|
||||
"host_list_software", "host_list_browser_history", "host_list_favorites",
|
||||
"host_list_win32_services", "host_list_driver_services",
|
||||
|
||||
+310
-122
@@ -241,7 +241,7 @@ Json::Value MakeListOutputSchema(const char* arrayKey, const Json::Value& itemPr
|
||||
}
|
||||
|
||||
Json::Value HostIdProp() {
|
||||
return PropStr(u8"主机 id,取 list_online_hosts / search_hosts 返回的 id 字段");
|
||||
return PropStr(u8"主机 id,取 list_hosts 返回的 id 字段");
|
||||
}
|
||||
|
||||
// 所有读工具的公共分页参数
|
||||
@@ -2068,6 +2068,171 @@ static std::string BuildHostGetHostsFile(const Json::Value& id, const Json::Valu
|
||||
return BuildStructuredResult(id, sc, summary, &textPayload);
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// P2-1:host_inspect —— 10 个 host_list_* / host_get_hosts_file 合并成一个工具
|
||||
// ============================================================================
|
||||
// 单个 aspect 直接走原 builder,输出与旧工具逐字节一致(旧工具名保留为别名,分派到
|
||||
// 同一个入口);多个 aspect 串行取,每个 aspect 一个 managed 会话,结果收进
|
||||
// results.<aspect>,某个 aspect 失败只记入 errors.<aspect>,不影响其它 aspect。
|
||||
|
||||
namespace {
|
||||
|
||||
typedef std::string (*InspectBuilder)(const Json::Value&, const Json::Value&, CMy2015RemoteDlg*);
|
||||
|
||||
std::string BuildInspectWin32Services(const Json::Value& id, const Json::Value& args,
|
||||
CMy2015RemoteDlg* parent) {
|
||||
return BuildHostListServices(id, args, parent, /*drivers=*/false);
|
||||
}
|
||||
|
||||
std::string BuildInspectDriverServices(const Json::Value& id, const Json::Value& args,
|
||||
CMy2015RemoteDlg* parent) {
|
||||
return BuildHostListServices(id, args, parent, /*drivers=*/true);
|
||||
}
|
||||
|
||||
struct InspectAspect {
|
||||
const char* name;
|
||||
const char* what; // 摘要里的中文名
|
||||
InspectBuilder build;
|
||||
};
|
||||
|
||||
// aspects 的枚举顺序即此处顺序;schema 与校验都从这里来,避免两处漂移。
|
||||
const InspectAspect kInspectAspects[] = {
|
||||
{ "processes", u8"进程", BuildHostListProcesses },
|
||||
{ "windows", u8"窗口", BuildHostListWindows },
|
||||
{ "network", u8"网络连接", BuildHostListNetworkState },
|
||||
{ "software", u8"软件", BuildHostListSoftware },
|
||||
{ "browser_history", u8"浏览记录", BuildHostListBrowserHistory },
|
||||
{ "favorites", u8"收藏夹", BuildHostListFavorites },
|
||||
{ "win32_services", u8"Win32 服务", BuildInspectWin32Services },
|
||||
{ "driver_services", u8"驱动服务", BuildInspectDriverServices },
|
||||
{ "scheduled_tasks", u8"计划任务", BuildHostListScheduledTasks },
|
||||
{ "hosts_file", u8"hosts 文件", BuildHostGetHostsFile },
|
||||
};
|
||||
|
||||
std::string ValidAspectList() {
|
||||
std::string s;
|
||||
for (const InspectAspect& a : kInspectAspects) {
|
||||
if (!s.empty()) s += ", ";
|
||||
s += a.name;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
bool ReadInspectAspects(const Json::Value& id, const Json::Value& args,
|
||||
std::vector<const InspectAspect*>& out, std::string& errJson) {
|
||||
const Json::Value& v = args["aspects"];
|
||||
if (!v.isArray() || v.size() == 0) {
|
||||
errJson = BuildError(id, -32602,
|
||||
"Invalid aspects: must be a non-empty array; valid: " + ValidAspectList());
|
||||
return false;
|
||||
}
|
||||
for (Json::ArrayIndex i = 0; i < v.size(); ++i) {
|
||||
if (!v[i].isString()) {
|
||||
errJson = BuildError(id, -32602, "Invalid aspects: every entry must be a string");
|
||||
return false;
|
||||
}
|
||||
const std::string s = v[i].asString();
|
||||
const InspectAspect* hit = nullptr;
|
||||
for (const InspectAspect& a : kInspectAspects) {
|
||||
if (s == a.name) { hit = &a; break; }
|
||||
}
|
||||
if (!hit) {
|
||||
errJson = BuildError(id, -32602,
|
||||
"Invalid aspect '" + s + "'; valid: " + ValidAspectList());
|
||||
return false;
|
||||
}
|
||||
bool dup = false;
|
||||
for (const InspectAspect* p : out) {
|
||||
if (p == hit) { dup = true; break; }
|
||||
}
|
||||
if (!dup) out.push_back(hit);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// 把一个 builder 的完整 JSON-RPC 响应拆成 structuredContent + 摘要文本 / 错误码。
|
||||
struct InspectRun {
|
||||
int code = 0; // 0 = 成功
|
||||
Json::Value sc;
|
||||
std::string text;
|
||||
};
|
||||
|
||||
bool RunInspectAspect(const InspectAspect& a, const Json::Value& id, const Json::Value& args,
|
||||
CMy2015RemoteDlg* parent, InspectRun& run) {
|
||||
const std::string resp = a.build(id, args, parent);
|
||||
Json::Value doc;
|
||||
Json::Reader reader;
|
||||
if (!reader.parse(resp, doc) || !doc.isObject()) {
|
||||
run.code = kErrGeneric;
|
||||
run.text = "internal error: unparsable tool result";
|
||||
return false;
|
||||
}
|
||||
if (doc.isMember("error") && doc["error"].isObject()) {
|
||||
run.code = doc["error"]["code"].asInt();
|
||||
run.text = doc["error"]["message"].asString();
|
||||
return false;
|
||||
}
|
||||
const Json::Value& result = doc["result"];
|
||||
if (!result.isObject()) {
|
||||
run.code = kErrGeneric;
|
||||
run.text = "internal error: missing result";
|
||||
return false;
|
||||
}
|
||||
run.sc = result["structuredContent"];
|
||||
if (result["content"].isArray() && result["content"].size() > 0)
|
||||
run.text = JsonStrField(result["content"][0], "text");
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string BuildHostInspect(const Json::Value& id, const Json::Value& args,
|
||||
CMy2015RemoteDlg* parent) {
|
||||
std::vector<const InspectAspect*> aspects;
|
||||
std::string errJson;
|
||||
if (!ReadInspectAspects(id, args, aspects, errJson)) return errJson;
|
||||
|
||||
// 单 aspect:原样返回旧 builder 的响应——输出与旧工具(以及旧名别名)逐字节一致。
|
||||
if (aspects.size() == 1) return aspects[0]->build(id, args, parent);
|
||||
|
||||
Json::Value results(Json::objectValue);
|
||||
Json::Value errors(Json::objectValue);
|
||||
std::string summary;
|
||||
int okCount = 0, failCount = 0;
|
||||
for (const InspectAspect* a : aspects) {
|
||||
InspectRun run;
|
||||
if (!summary.empty()) summary += u8";";
|
||||
if (RunInspectAspect(*a, id, args, parent, run)) {
|
||||
results[a->name] = run.sc;
|
||||
okCount++;
|
||||
summary += std::string(a->what) + ":" + (run.text.empty() ? std::string("ok") : run.text);
|
||||
} else {
|
||||
Json::Value e(Json::objectValue);
|
||||
if (run.code) e["code"] = run.code;
|
||||
e["message"] = run.text;
|
||||
errors[a->name] = e;
|
||||
failCount++;
|
||||
summary += std::string(a->what) + u8":失败(" +
|
||||
(run.code ? std::to_string(run.code) + " " : std::string()) + run.text + ")";
|
||||
}
|
||||
}
|
||||
|
||||
Json::Value sc(Json::objectValue);
|
||||
sc["results"] = results;
|
||||
if (failCount) sc["errors"] = errors;
|
||||
|
||||
Json::Value result(Json::objectValue);
|
||||
result["structuredContent"] = sc;
|
||||
Json::Value content(Json::arrayValue);
|
||||
Json::Value item(Json::objectValue);
|
||||
item["type"] = "text";
|
||||
item["text"] = summary;
|
||||
content.append(item);
|
||||
result["content"] = content;
|
||||
result["isError"] = (okCount == 0);
|
||||
return BuildResult(id, result);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
// ============================================================================
|
||||
// 主机管理:写工具(只读 + 可恢复操作)
|
||||
// ============================================================================
|
||||
@@ -2823,19 +2988,131 @@ Json::Value ReadInputSchemaBatch(Json::Value props) {
|
||||
return schema;
|
||||
}
|
||||
|
||||
// 只有 id/ids、没有分页的只读工具(host_get_hosts_file 用 max_bytes 控大小)
|
||||
Json::Value IdOrIdsSchema(Json::Value props) {
|
||||
AppendBatchIdsProp(props);
|
||||
Json::Value schema = MakeSchema(props, {});
|
||||
MakeIdOrIdsRequired(schema);
|
||||
// ===== host_inspect(P2-1:10 个 host_list_* / host_get_hosts_file 合并)=====
|
||||
|
||||
// 过滤参数按 aspect 生效,其余 aspect 忽略;全部可选、AND 组合、子串匹配。
|
||||
Json::Value BuildHostInspectInputSchema() {
|
||||
Json::Value props(Json::objectValue);
|
||||
props["id"] = HostIdProp();
|
||||
|
||||
Json::Value aspects(Json::objectValue);
|
||||
aspects["type"] = "array";
|
||||
aspects["minItems"] = 1;
|
||||
Json::Value items(Json::objectValue);
|
||||
items["type"] = "string";
|
||||
Json::Value enums(Json::arrayValue);
|
||||
for (const InspectAspect& a : kInspectAspects) enums.append(a.name);
|
||||
items["enum"] = enums;
|
||||
aspects["items"] = items;
|
||||
aspects["description"] = u8"要取的方面(必填、可多选、自动去重):"
|
||||
u8"processes=进程,windows=可见顶层窗口,network=网络连接(进程视角),"
|
||||
u8"software=已安装软件,browser_history=IE 浏览历史,favorites=IE 收藏夹,"
|
||||
u8"win32_services=Win32 服务,driver_services=驱动服务,"
|
||||
u8"scheduled_tasks=计划任务,hosts_file=hosts 文件";
|
||||
props["aspects"] = aspects;
|
||||
|
||||
props["pid"] = PropInt(u8"按 PID 过滤:processes / windows(所属进程)/ network");
|
||||
props["name"] = PropStr(u8"按名称子串过滤:processes(映像名)/ software(软件名)/ "
|
||||
u8"win32_services|driver_services(服务名或显示名)/ scheduled_tasks(任务名)");
|
||||
props["arch"] = PropStrEnum(u8"按架构过滤:processes", { "x86", "x64" });
|
||||
props["title"] = PropStr(u8"按标题子串过滤:windows(窗口标题)/ browser_history(网页标题)");
|
||||
props["url"] = PropStr(u8"按 URL 子串过滤:browser_history / favorites");
|
||||
props["publisher"] = PropStr(u8"按发布者子串过滤:software");
|
||||
props["folder"] = PropStr(u8"按任务文件夹子串过滤(如 \\Microsoft):scheduled_tasks");
|
||||
props["status"] = PropStr(u8"按状态子串过滤(如 Running / Ready):win32_services / driver_services / scheduled_tasks");
|
||||
props["start_type"] = PropStr(u8"按启动类型子串过滤(如 Auto):win32_services / driver_services");
|
||||
props["process"] = PropStr(u8"按进程名子串过滤:network");
|
||||
props["protocol"] = PropStrEnum(u8"按协议过滤:network", { "tcp", "udp", "all" });
|
||||
props["local_port"] = PropInt(u8"按本地端口精确过滤:network");
|
||||
props["remote_port"] = PropInt(u8"按远端端口精确过滤:network");
|
||||
props["state"] = PropStr(u8"按状态子串过滤(如 ESTABLISHED):network");
|
||||
props["include_content"] = PropBool(u8"是否返回按行切分的内容,默认 true:hosts_file");
|
||||
props["max_bytes"] = PropInt(u8"最多返回的原始字节数,默认 262144,上限 1048576:hosts_file");
|
||||
|
||||
AddPagingProps(props);
|
||||
Json::Value schema = ReadInputSchemaBatch(props);
|
||||
// aspects 是必填:ReadInputSchemaBatch 只留下 id/ids 的 anyOf,这里补回 required。
|
||||
// 不写进 schema 的话,按 schema 校验的客户端会以为可以省略,运行时才吃到 -32602。
|
||||
Json::Value req(Json::arrayValue);
|
||||
req.append("aspects");
|
||||
schema["required"] = req;
|
||||
return schema;
|
||||
}
|
||||
|
||||
// hosts_file 的输出 schema(原 host_get_hosts_file 的字段,一字不改)
|
||||
Json::Value HostsFileOutputSchema() {
|
||||
Json::Value outProps(Json::objectValue);
|
||||
outProps["path"] = PropStr();
|
||||
outProps["encoding"] = PropStr(u8"utf-8 / gbk(自动探测)");
|
||||
outProps["bytes"] = PropInt(u8"文件原始字节数");
|
||||
outProps["returnedBytes"] = PropInt();
|
||||
outProps["truncated"] = PropBool();
|
||||
outProps["lineCount"] = PropInt();
|
||||
Json::Value lines(Json::objectValue);
|
||||
lines["type"] = "array";
|
||||
lines["items"] = PropStr();
|
||||
outProps["lines"] = lines;
|
||||
outProps["content"] = PropStr(u8"未截断时的完整文本");
|
||||
|
||||
Json::Value out(Json::objectValue);
|
||||
out["type"] = "object";
|
||||
out["properties"] = outProps;
|
||||
return out;
|
||||
}
|
||||
|
||||
Json::Value BuildHostInspectOutputSchema() {
|
||||
Json::Value resultsProps(Json::objectValue);
|
||||
resultsProps["processes"] = MakeListOutputSchema("processes", ProcessItemSchema());
|
||||
Json::Value windows = MakeListOutputSchema("windows", WindowItemSchema());
|
||||
windows["properties"]["truncated"] =
|
||||
PropBool(u8"为 true 时表示客户端的可见窗口多于单次返回上限(96 条),列表不完整");
|
||||
resultsProps["windows"] = windows;
|
||||
resultsProps["network"] = MakeListOutputSchema("connections", NetStateItemSchema());
|
||||
resultsProps["software"] = MakeListOutputSchema("software", SoftwareItemSchema());
|
||||
resultsProps["browser_history"] = MakeListOutputSchema("history", HistoryItemSchema());
|
||||
resultsProps["favorites"] = MakeListOutputSchema("favorites", FavoriteItemSchema());
|
||||
resultsProps["win32_services"] = MakeListOutputSchema("services", ServiceItemSchema());
|
||||
resultsProps["driver_services"] = MakeListOutputSchema("services", ServiceItemSchema());
|
||||
resultsProps["scheduled_tasks"] = MakeListOutputSchema("tasks", TaskItemSchema());
|
||||
resultsProps["hosts_file"] = HostsFileOutputSchema();
|
||||
|
||||
Json::Value results(Json::objectValue);
|
||||
results["type"] = "object";
|
||||
results["description"] = u8"按 aspect 名索引;每个值的形状与单 aspect 调用的顶层一致";
|
||||
results["properties"] = resultsProps;
|
||||
|
||||
Json::Value errItem(Json::objectValue);
|
||||
errItem["type"] = "object";
|
||||
Json::Value errProps(Json::objectValue);
|
||||
errProps["code"] = PropInt(u8"JSON-RPC 错误码,如 -32001 超时、-32005 平台不支持");
|
||||
errProps["message"] = PropStr(u8"错误说明");
|
||||
errItem["properties"] = errProps;
|
||||
|
||||
Json::Value errors(Json::objectValue);
|
||||
errors["type"] = "object";
|
||||
errors["description"] = u8"只有失败的 aspect 才会出现;不影响其它 aspect 的结果";
|
||||
errors["additionalProperties"] = errItem;
|
||||
|
||||
Json::Value props(Json::objectValue);
|
||||
props["results"] = results;
|
||||
props["errors"] = errors;
|
||||
|
||||
Json::Value schema(Json::objectValue);
|
||||
schema["type"] = "object";
|
||||
schema["properties"] = props;
|
||||
// 单 aspect 时顶层直接是该 aspect 的列表结果(与旧工具逐字节一致),两种形状都合法。
|
||||
schema["additionalProperties"] = true;
|
||||
return schema;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
bool Handles(const std::string& toolName) {
|
||||
// host_inspect 之后的 10 个旧名(host_list_* / host_get_hosts_file)是 P2-1 合并后
|
||||
// 保留的别名:不出现在 tools/list,但调用仍按旧行为处理。新增调用方请用 host_inspect。
|
||||
static const char* kTools[] = {
|
||||
"list_network_connections", "kill_network_connection",
|
||||
"host_inspect",
|
||||
"host_list_processes", "host_list_windows", "host_list_network_state",
|
||||
"host_list_software", "host_list_browser_history", "host_list_favorites",
|
||||
"host_list_win32_services", "host_list_driver_services",
|
||||
@@ -2887,118 +3164,28 @@ void AppendTools(Json::Value& tools) {
|
||||
ActionOutputSchema());
|
||||
}
|
||||
|
||||
// ---- 主机管理:10 个只读标签页 ----
|
||||
// ---- 主机管理:host_inspect(P2-1:原 10 个 host_list_* / host_get_hosts_file 合并)----
|
||||
{
|
||||
Json::Value props(Json::objectValue);
|
||||
props["pid"] = PropInt(u8"按 PID 过滤");
|
||||
props["name"] = PropStr(u8"按进程名子串过滤");
|
||||
props["arch"] = PropStrEnum(u8"按架构过滤", { "x86", "x64" });
|
||||
AddTool(tools, "host_list_processes",
|
||||
u8"列出在线 Windows 主机的进程(主机管理「进程」标签页)。返回 PID、架构、窗口标题、路径、优先级、线程数、用户、工作集与文件大小。首选:与 list_processes 同源但字段更全,并支持服务端过滤(pid / name / arch),仅在它没有出现在 tools/list 里(McpMachine=0)时退回 list_processes。",
|
||||
ReadInputSchemaBatch(props), MakeListOutputSchema("processes", ProcessItemSchema()));
|
||||
}
|
||||
{
|
||||
Json::Value props(Json::objectValue);
|
||||
props["pid"] = PropInt(u8"按所属进程 PID 过滤");
|
||||
props["title"] = PropStr(u8"按窗口标题子串过滤");
|
||||
Json::Value outSchema = MakeListOutputSchema("windows", WindowItemSchema());
|
||||
// 客户端单个响应包最多装 96 条窗口;超出时这里给出 true,表示 windows
|
||||
// 只是可见窗口的一个前缀,翻页也取不到剩下的部分。
|
||||
outSchema["properties"]["truncated"] =
|
||||
PropBool(u8"为 true 时表示客户端的可见窗口多于单次返回上限(96 条),列表不完整");
|
||||
AddTool(tools, "host_list_windows",
|
||||
u8"列出在线 Windows 主机上当前可见的顶层窗口(主机管理「窗口」标签页)。只包含可见窗口,故隐藏后窗口会从结果中消失;单次最多返回 96 条,可见窗口更多时 truncated=true 且列表不完整(不能据此断定某个窗口不存在)。hwnd 可用于 host_control_window 或 operate_window。首选:支持服务端过滤(pid / title),仅在它没有出现在 tools/list 里(McpMachine=0)时退回 list_windows。",
|
||||
ReadInputSchemaBatch(props), outSchema);
|
||||
}
|
||||
{
|
||||
Json::Value props(Json::objectValue);
|
||||
props["pid"] = PropInt();
|
||||
props["process"] = PropStr(u8"按进程名子串过滤");
|
||||
props["protocol"] = PropStrEnum(u8"协议过滤", { "tcp", "udp" });
|
||||
props["local_port"] = PropInt();
|
||||
props["remote_port"] = PropInt();
|
||||
props["state"] = PropStr(u8"按状态子串过滤");
|
||||
AddTool(tools, "host_list_network_state",
|
||||
u8"列出在线 Windows 主机的网络连接及其所属进程(主机管理「网络状态」标签页)。数据来源与「连接管理」不同(这里是进程视角、含 UDP 的无对端标记);仅支持 IPv4 展示。",
|
||||
ReadInputSchemaBatch(props), MakeListOutputSchema("connections", NetStateItemSchema()));
|
||||
}
|
||||
{
|
||||
Json::Value props(Json::objectValue);
|
||||
props["name"] = PropStr(u8"按软件名子串过滤");
|
||||
props["publisher"] = PropStr(u8"按发布者子串过滤");
|
||||
AddTool(tools, "host_list_software",
|
||||
u8"列出在线 Windows 主机已安装的软件(主机管理「软件」标签页,来自注册表 Uninstall 项)。只读;不提供卸载能力。",
|
||||
ReadInputSchemaBatch(props), MakeListOutputSchema("software", SoftwareItemSchema()));
|
||||
}
|
||||
{
|
||||
Json::Value props(Json::objectValue);
|
||||
props["title"] = PropStr(u8"按标题子串过滤");
|
||||
props["url"] = PropStr(u8"按 URL 子串过滤");
|
||||
AddTool(tools, "host_list_browser_history",
|
||||
u8"列出在线 Windows 主机的 IE 浏览历史(主机管理「浏览记录」标签页)。隐私数据,仅在显式开启主机管理时可见。",
|
||||
ReadInputSchemaBatch(props), MakeListOutputSchema("history", HistoryItemSchema()));
|
||||
}
|
||||
{
|
||||
Json::Value props(Json::objectValue);
|
||||
props["name"] = PropStr(u8"按收藏名子串过滤");
|
||||
props["url"] = PropStr(u8"按 URL 子串过滤");
|
||||
AddTool(tools, "host_list_favorites",
|
||||
u8"列出在线 Windows 主机的 IE 收藏夹(主机管理「收藏夹」标签页)。隐私数据,仅在显式开启主机管理时可见。",
|
||||
ReadInputSchemaBatch(props), MakeListOutputSchema("favorites", FavoriteItemSchema()));
|
||||
}
|
||||
{
|
||||
Json::Value props(Json::objectValue);
|
||||
props["name"] = PropStr(u8"按服务名或显示名子串过滤");
|
||||
props["status"] = PropStr(u8"按状态子串过滤,如 Running");
|
||||
props["start_type"] = PropStr(u8"按启动类型子串过滤,如 Auto");
|
||||
AddTool(tools, "host_list_win32_services",
|
||||
u8"列出在线 Windows 主机的 Win32 服务(主机管理「服务」标签页之一)。返回显示名、描述、状态、启动类型、登录身份、服务名与可执行路径;服务名可用于 host_control_service。首选:支持服务端过滤(name / status),仅在它没有出现在 tools/list 里(McpMachine=0)时退回 list_services。",
|
||||
ReadInputSchemaBatch(props), MakeListOutputSchema("services", ServiceItemSchema()));
|
||||
}
|
||||
{
|
||||
Json::Value props(Json::objectValue);
|
||||
props["name"] = PropStr(u8"按服务名或显示名子串过滤");
|
||||
props["status"] = PropStr(u8"按状态子串过滤");
|
||||
props["start_type"] = PropStr(u8"按启动类型子串过滤");
|
||||
AddTool(tools, "host_list_driver_services",
|
||||
u8"列出在线 Windows 主机的驱动服务(主机管理「服务」标签页之一)。字段同 host_list_win32_services。",
|
||||
ReadInputSchemaBatch(props), MakeListOutputSchema("services", ServiceItemSchema()));
|
||||
}
|
||||
{
|
||||
Json::Value props(Json::objectValue);
|
||||
props["name"] = PropStr(u8"按任务名子串过滤");
|
||||
props["folder"] = PropStr(u8"按任务文件夹子串过滤,如 \\Microsoft");
|
||||
props["status"] = PropStr(u8"按状态子串过滤,如 Ready / Disabled");
|
||||
AddTool(tools, "host_list_scheduled_tasks",
|
||||
u8"列出在线 Windows 主机的计划任务(主机管理「计划任务」标签页)。返回任务名、完整路径、所在文件夹、可执行文件、状态与上次/下次运行时间。任务名 + folder 可用于 host_control_task。",
|
||||
ReadInputSchemaBatch(props), MakeListOutputSchema("tasks", TaskItemSchema()));
|
||||
}
|
||||
{
|
||||
Json::Value props(Json::objectValue);
|
||||
props["id"] = HostIdProp();
|
||||
props["include_content"] = PropBool(u8"是否返回按行切分的内容,默认 true");
|
||||
props["max_bytes"] = PropInt(u8"最多返回的原始字节数,默认 262144,上限 1048576");
|
||||
|
||||
Json::Value outProps(Json::objectValue);
|
||||
outProps["path"] = PropStr();
|
||||
outProps["encoding"] = PropStr(u8"utf-8 / gbk(自动探测)");
|
||||
outProps["bytes"] = PropInt(u8"文件原始字节数");
|
||||
outProps["returnedBytes"] = PropInt();
|
||||
outProps["truncated"] = PropBool();
|
||||
outProps["lineCount"] = PropInt();
|
||||
Json::Value lines(Json::objectValue);
|
||||
lines["type"] = "array";
|
||||
lines["items"] = PropStr();
|
||||
outProps["lines"] = lines;
|
||||
outProps["content"] = PropStr(u8"未截断时的完整文本");
|
||||
|
||||
Json::Value out(Json::objectValue);
|
||||
out["type"] = "object";
|
||||
out["properties"] = outProps;
|
||||
|
||||
AddTool(tools, "host_get_hosts_file",
|
||||
u8"读取在线 Windows 主机的 hosts 文件(主机管理「HOSTS」标签页),按行返回并自动识别 UTF-8/GBK。只读;不提供写入能力。",
|
||||
IdOrIdsSchema(props), out);
|
||||
AddTool(tools, "host_inspect",
|
||||
u8"一次取回在线 Windows 主机的多类主机管理信息(原 10 个 host_list_* 工具合并)。aspects 必填、可多选:"
|
||||
u8"processes(进程:PID/架构/窗口标题/路径/优先级/线程数/用户/工作集与文件大小)| "
|
||||
u8"windows(当前可见顶层窗口;只含可见窗口,单次最多 96 条,超出时 truncated=true 且列表不完整,"
|
||||
u8"不能据此断定某窗口不存在;hwnd 可交给 host_control_window / operate_window)| "
|
||||
u8"network(网络连接,进程视角、含 UDP;与 list_network_connections 的「连接管理」数据源不同)| "
|
||||
u8"software(已安装软件,来自注册表 Uninstall 项;不提供卸载)| "
|
||||
u8"browser_history(IE 浏览历史,隐私数据)| favorites(IE 收藏夹,隐私数据)| "
|
||||
u8"win32_services(Win32 服务;服务名可用于 host_control_service)| "
|
||||
u8"driver_services(驱动服务;字段同 win32_services)| "
|
||||
u8"scheduled_tasks(计划任务;任务名 + folder 可用于 host_control_task)| "
|
||||
u8"hosts_file(按行返回并自动识别 UTF-8/GBK)。"
|
||||
u8"注意:win32_services / driver_services 要求客户端以管理员权限运行——非提权客户端"
|
||||
u8"拿不到 SCM 句柄后直接不回应,调用会在约 12 秒后超时(同等场景 list_services 会明确报 access denied)。"
|
||||
u8"过滤参数按 aspect 生效、其余忽略(见各参数说明),在服务端完成且先于分页:"
|
||||
u8"total 为命中数、totalAll 为该项全部条目数。"
|
||||
u8"单个 aspect 时顶层就是该项的列表结果(与合并前的旧工具一致);多个 aspect 时汇总在 "
|
||||
u8"results.<aspect>,某个 aspect 失败只记入 errors.<aspect>、不影响其它 aspect,全部失败才 isError=true。"
|
||||
u8"每多选一个 aspect 就多一次子连接,耗时线性增长,不需要的不要选。只读。",
|
||||
BuildHostInspectInputSchema(), BuildHostInspectOutputSchema());
|
||||
}
|
||||
|
||||
// ---- 主机管理:4 个写工具(只读 + 可恢复操作) ----
|
||||
@@ -3025,11 +3212,11 @@ void AppendTools(Json::Value& tools) {
|
||||
types.append("integer");
|
||||
types.append("string");
|
||||
hwnd["type"] = types;
|
||||
hwnd["description"] = u8"窗口句柄,取 host_list_windows 的 hwnd;整数或 0x 前缀字符串";
|
||||
hwnd["description"] = u8"窗口句柄,取 host_inspect(aspects=[\"windows\"])或 list_windows 的 hwnd;整数或 0x 前缀字符串";
|
||||
props["hwnd"] = hwnd;
|
||||
props["dry_run"] = PropBool(u8"true 时只校验 hwnd 仍在可见窗口列表里并返回该窗口,不下发操作,默认 false");
|
||||
AddTool(tools, "host_control_window",
|
||||
u8"对在线 Windows 主机的窗口执行可恢复操作:restore(还原)/hide(隐藏)/maximize(最大化)/minimize(最小化)/activate(激活到前台)。hwnd 取 host_list_windows 或 list_windows 返回的 hwnd。动作后重新枚举可见窗口复核:hide 后 hwnd 应消失,其余动作后仍应存在;activate 会额外复核 GetForegroundWindow,目标未成为前台则 ok=false、reason=not_foreground。activate 需要新客户端(窗口信息能力),旧客户端返回 -32005,可退回 restore。不提供关闭窗口——需要 close / show 时改用 operate_window。dry_run=true 只核实 hwnd 并返回窗口信息。",
|
||||
u8"对在线 Windows 主机的窗口执行可恢复操作:restore(还原)/hide(隐藏)/maximize(最大化)/minimize(最小化)/activate(激活到前台)。hwnd 取 host_inspect 的 windows 项或 list_windows 返回的 hwnd。动作后重新枚举可见窗口复核:hide 后 hwnd 应消失,其余动作后仍应存在;activate 会额外复核 GetForegroundWindow,目标未成为前台则 ok=false、reason=not_foreground。activate 需要新客户端(窗口信息能力),旧客户端返回 -32005,可退回 restore。不提供关闭窗口——需要 close / show 时改用 operate_window。dry_run=true 只核实 hwnd 并返回窗口信息。",
|
||||
MakeSchema(props, { "id", "action", "hwnd" }),
|
||||
ActionOutputSchema());
|
||||
}
|
||||
@@ -3038,7 +3225,7 @@ void AppendTools(Json::Value& tools) {
|
||||
props["id"] = HostIdProp();
|
||||
props["action"] = PropStrEnum(u8"start/stop/pause/continue/restart",
|
||||
{ "start", "stop", "pause", "continue", "restart" });
|
||||
props["name"] = PropStr(u8"服务名(ServiceName,不是显示名),取 host_list_*_services 的 name");
|
||||
props["name"] = PropStr(u8"服务名(ServiceName,不是显示名),取 host_inspect 的 win32_services / driver_services 项的 name");
|
||||
props["dry_run"] = PropBool(u8"true 时只校验服务存在并返回当前状态,不下发控制命令,默认 false");
|
||||
AddTool(tools, "host_control_service",
|
||||
u8"控制在线 Windows 主机的服务:start/stop/pause/continue/restart。客户端对每次控制都会自动回一份刷新后的服务列表,工具据此复核状态并如实返回 ok;stop 与 restart 归入危险操作,需要同时开启 McpMachineDangerous。restart 先 stop 再 start。不提供删除服务。dry_run=true 只核实服务并返回当前状态,不下发命令(是否已是目标状态由你按 state 判断)。",
|
||||
@@ -3049,7 +3236,7 @@ void AppendTools(Json::Value& tools) {
|
||||
Json::Value props(Json::objectValue);
|
||||
props["id"] = HostIdProp();
|
||||
props["action"] = PropStrEnum(u8"run=立即运行,stop=停止正在运行的任务", { "run", "stop" });
|
||||
props["name"] = PropStr(u8"任务名,取 host_list_scheduled_tasks 的 name");
|
||||
props["name"] = PropStr(u8"任务名,取 host_inspect 的 scheduled_tasks 项的 name");
|
||||
props["folder"] = PropStr(u8"可选:任务所在文件夹;同名任务存在多个时必填");
|
||||
props["dry_run"] = PropBool(u8"true 时只校验任务存在(含同名歧义检查)并返回当前状态,不下发 run/stop,默认 false");
|
||||
AddTool(tools, "host_control_task",
|
||||
@@ -3077,7 +3264,8 @@ std::string Call(const Json::Value& id, const std::string& toolName,
|
||||
if (toolName == "kill_network_connection")
|
||||
return BuildKillNetworkConnection(id, args, parent);
|
||||
|
||||
// ---- 主机管理:只读 ----
|
||||
// ---- 主机管理:只读(host_inspect 及合并后的旧名别名) ----
|
||||
if (toolName == "host_inspect") return BuildHostInspect(id, args, parent);
|
||||
if (toolName == "host_list_processes") return BuildHostListProcesses(id, args, parent);
|
||||
if (toolName == "host_list_windows") return BuildHostListWindows(id, args, parent);
|
||||
if (toolName == "host_list_network_state") return BuildHostListNetworkState(id, args, parent);
|
||||
|
||||
@@ -287,10 +287,10 @@ const char* kServerInstructions =
|
||||
u8"当前开关状态可查 get_server_status 的 switches。只读模式(readonly=true)会挡掉大部分写工具,"
|
||||
u8"但只改服务端本地数据的 host_set_remark / host_set_watch_level 仍会列出,调用时才被拒;"
|
||||
u8"get_keylog 也始终可见,只读模式下只是它的 clear / set_offline 参数被拒,读取不受影响。\n"
|
||||
u8"同一能力存在两套工具时优先用主机管理族:host_list_processes / host_list_windows / "
|
||||
u8"host_list_win32_services 字段更全(host_list_windows 支持 pid/title 过滤,"
|
||||
u8"host_list_win32_services 支持 name/status 过滤),list_processes / list_windows / list_services "
|
||||
u8"是它们在 McpMachine=0 时的降级路径。关闭窗口只有 operate_window 能做,host_control_window 没有 close。\n"
|
||||
u8"同一能力存在两套工具时优先用主机管理族:host_inspect(aspects 选 processes / windows / "
|
||||
u8"win32_services 等,支持 pid/title/status 等服务端过滤,字段更全),list_processes / "
|
||||
u8"list_windows / list_services 是它在 McpMachine=0 时的降级路径。关闭窗口只有 operate_window 能做,"
|
||||
u8"host_control_window 没有 close。\n"
|
||||
u8"\n"
|
||||
u8"3) 错误码与动作\n"
|
||||
u8"-32002 主机离线或不存在:先刷新主机列表再选,不要拿旧快照反复重试。\n"
|
||||
@@ -319,7 +319,7 @@ const char* kServerInstructions =
|
||||
u8"它们的 ok 同样只代表客户端回了完成包,真实结果看 verified(true=复核确认生效、"
|
||||
u8"false=复核确认未生效、null=复核没做成);删除不可恢复,recursive 必须显式传 true。"
|
||||
u8"列表结果按 limit/offset 分页,total 是命中数、totalAll 是过滤前的总数。\n"
|
||||
u8"进程排查:host_list_processes 或 list_processes 定位,kill_process 结束。这类动作没有真实回执,"
|
||||
u8"进程排查:host_inspect(aspects=[\"processes\"])或 list_processes 定位,kill_process 结束。这类动作没有真实回执,"
|
||||
u8"拿到 ok 后应再列一次复核,不要凭 ok 断言已生效。\n"
|
||||
u8"GUI 自动化:remote_open 取得 session_id 与分辨率(screen_w/screen_h)→ get_screenshot 看画面 → "
|
||||
u8"get_foreground_window 确认前台窗口(或用 remote_mouse / remote_keyboard 的 expect_hwnd 做前置校验)→ "
|
||||
@@ -993,7 +993,7 @@ Json::Value BuildHostItemSchema() {
|
||||
return itemProps;
|
||||
}
|
||||
|
||||
// 列表型 outputSchema 的公共翻页字段,字段名与 McpMachine.cpp 的 host_list_* 保持一致
|
||||
// 列表型 outputSchema 的公共翻页字段,字段名与 McpMachine.cpp 的 host_inspect 保持一致
|
||||
void AppendPageOutputProps(Json::Value& props) {
|
||||
const char* intFields[] = { "total", "totalAll", "offset", "limit" };
|
||||
for (const char* f : intFields) {
|
||||
@@ -1059,7 +1059,7 @@ Json::Value BuildHostDetailOutputSchema() {
|
||||
capProps["c2cPaths"] = boolProp(u8"能否按路径清单接收另一台主机的文件(copy_files_c2c 源端的前提)");
|
||||
capProps["registry"] = boolProp(u8"是否有 Windows 注册表可查(list_registry);仅 Windows 客户端为 true");
|
||||
capProps["windowInfo"] = boolProp(
|
||||
u8"是否支持窗口信息(get_foreground_window、host_list_windows 的坐标/前后台字段、"
|
||||
u8"是否支持窗口信息(get_foreground_window、host_inspect 的 windows 项坐标/前后台字段、"
|
||||
u8"operate_window/host_control_window 的 activate);仅声明 CLIENT_CAP_WINDOW_INFO 的新客户端为 true");
|
||||
Json::Value caps(Json::objectValue);
|
||||
caps["type"] = "object";
|
||||
@@ -1906,7 +1906,7 @@ Json::Value BuildGetScreenshotInputSchema() {
|
||||
hwndTypes.append("integer");
|
||||
hwndTypes.append("string");
|
||||
hwndProp["type"] = hwndTypes;
|
||||
hwndProp["description"] = u8"window 模式必填:窗口句柄(整数或 0x 前缀字符串),取 host_list_windows / get_foreground_window 返回的 hwnd。窗口最小化时无法抓取(返回错误),先 activate/restore。";
|
||||
hwndProp["description"] = u8"window 模式必填:窗口句柄(整数或 0x 前缀字符串),取 host_inspect 的 windows 项 / get_foreground_window 返回的 hwnd。窗口最小化时无法抓取(返回错误),先 activate/restore。";
|
||||
props["hwnd"] = hwndProp;
|
||||
|
||||
Json::Value monProp(Json::objectValue);
|
||||
@@ -2149,7 +2149,7 @@ std::string BuildToolsListResult(const Json::Value& id) {
|
||||
{
|
||||
Json::Value tool(Json::objectValue);
|
||||
tool["name"] = "list_processes";
|
||||
tool["description"] = u8"获取指定在线主机的进程列表(PID、映像名称、架构、程序完整路径)。通过主连接下发命令、子连接回传,一次性返回。可选 name(映像名子串,ASCII 不区分大小写)/ pid(精确)在服务端过滤,过滤在分页之前生效:total 为命中数、totalAll 为过滤前的总数。结果按 limit/offset 分页。定位是 McpMachine=0(主机管理工具关闭)时的降级路径,字段较少;若 host_list_processes 出现在 tools/list 里,一律优先用它。";
|
||||
tool["description"] = u8"获取指定在线主机的进程列表(PID、映像名称、架构、程序完整路径)。通过主连接下发命令、子连接回传,一次性返回。可选 name(映像名子串,ASCII 不区分大小写)/ pid(精确)在服务端过滤,过滤在分页之前生效:total 为命中数、totalAll 为过滤前的总数。结果按 limit/offset 分页。定位是 McpMachine=0(主机管理工具关闭)时的降级路径,字段较少;若 host_inspect 出现在 tools/list 里,一律优先用它的 processes 项。";
|
||||
|
||||
tool["inputSchema"] = BuildFilteredPagedHostListInputSchema(
|
||||
u8"按映像名子串过滤,ASCII 不区分大小写(如 chrome)",
|
||||
@@ -2163,7 +2163,7 @@ std::string BuildToolsListResult(const Json::Value& id) {
|
||||
{
|
||||
Json::Value tool(Json::objectValue);
|
||||
tool["name"] = "list_windows";
|
||||
tool["description"] = u8"获取指定在线主机的顶层窗口列表(句柄、窗口标题、窗口状态、所属进程 PID)。一次性返回。可选 name(窗口标题子串,ASCII 不区分大小写)/ pid(所属进程,精确)在服务端过滤,过滤在分页之前生效:total 为命中数、totalAll 为过滤前的总数。结果按 limit/offset 分页。定位是 McpMachine=0(主机管理工具关闭)时的降级路径;若 host_list_windows 出现在 tools/list 里,一律优先用它。";
|
||||
tool["description"] = u8"获取指定在线主机的顶层窗口列表(句柄、窗口标题、窗口状态、所属进程 PID)。一次性返回。可选 name(窗口标题子串,ASCII 不区分大小写)/ pid(所属进程,精确)在服务端过滤,过滤在分页之前生效:total 为命中数、totalAll 为过滤前的总数。结果按 limit/offset 分页。定位是 McpMachine=0(主机管理工具关闭)时的降级路径;若 host_inspect 出现在 tools/list 里,一律优先用它的 windows 项。";
|
||||
|
||||
tool["inputSchema"] = BuildFilteredPagedHostListInputSchema(
|
||||
u8"按窗口标题子串过滤,ASCII 不区分大小写(如 notepad);匹配的是标题不是进程名",
|
||||
@@ -2225,7 +2225,7 @@ std::string BuildToolsListResult(const Json::Value& id) {
|
||||
{
|
||||
Json::Value tool(Json::objectValue);
|
||||
tool["name"] = "list_services";
|
||||
tool["description"] = u8"获取指定在线 Windows 主机的服务列表(显示名、服务名、可执行文件路径、运行状态、启动类型)。仅 Windows 客户端支持;一次性返回,结果按 limit/offset 分页。不支持服务端过滤。定位是 McpMachine=0(主机管理工具关闭)时的降级路径,字段较少(无描述、登录身份);若 host_list_win32_services 出现在 tools/list 里,一律优先用它。";
|
||||
tool["description"] = u8"获取指定在线 Windows 主机的服务列表(显示名、服务名、可执行文件路径、运行状态、启动类型)。仅 Windows 客户端支持;一次性返回,结果按 limit/offset 分页。不支持服务端过滤。定位是 McpMachine=0(主机管理工具关闭)时的降级路径,字段较少(无描述、登录身份);若 host_inspect 出现在 tools/list 里,一律优先用它的 win32_services 项。";
|
||||
|
||||
tool["inputSchema"] = BuildPagedHostListInputSchema();
|
||||
tool["outputSchema"] = BuildServiceListOutputSchema();
|
||||
@@ -2632,7 +2632,7 @@ std::string BuildToolsListResult(const Json::Value& id) {
|
||||
{
|
||||
Json::Value tool(Json::objectValue);
|
||||
tool["name"] = "operate_window";
|
||||
tool["description"] = u8"对指定在线 Windows 主机的窗口执行操作:close(关闭)/show(显示)/hide(隐藏)/minimize(最小化)/maximize(最大化)/restore(还原)/activate(激活到前台)。hwnd 取 list_windows 或 host_list_windows 返回的 hwnd。ok 仅表示已下发(窗口句柄可能已失效);action=activate 例外:工具会在动作后用窗口信息 RPC 复核 GetForegroundWindow,返回 ok/state(foreground|background|missing)/window,旧客户端不支持时返回 -32005(可退回 show)。关闭窗口只有本工具能做,host_control_window 不提供 close,且它会重新枚举可见窗口复核结果。dry_run=true 只校验 hwnd 是否还在可见窗口列表里并返回该窗口信息,不发送任何命令。";
|
||||
tool["description"] = u8"对指定在线 Windows 主机的窗口执行操作:close(关闭)/show(显示)/hide(隐藏)/minimize(最小化)/maximize(最大化)/restore(还原)/activate(激活到前台)。hwnd 取 list_windows 或 host_inspect 的 windows 项返回的 hwnd。ok 仅表示已下发(窗口句柄可能已失效);action=activate 例外:工具会在动作后用窗口信息 RPC 复核 GetForegroundWindow,返回 ok/state(foreground|background|missing)/window,旧客户端不支持时返回 -32005(可退回 show)。关闭窗口只有本工具能做,host_control_window 不提供 close,且它会重新枚举可见窗口复核结果。dry_run=true 只校验 hwnd 是否还在可见窗口列表里并返回该窗口信息,不发送任何命令。";
|
||||
tool["inputSchema"] = BuildOperateWindowInputSchema();
|
||||
tool["outputSchema"] = BuildOperateWindowOutputSchema();
|
||||
tools.append(tool);
|
||||
@@ -2945,7 +2945,7 @@ void AppendHostTechnicalDetail(CMy2015RemoteDlg* parent, uint64_t devId, Json::V
|
||||
caps["fileTransferV2"] = ctx->SupportsFileV2();
|
||||
caps["c2cPaths"] = ctx->SupportsC2CPaths();
|
||||
caps["registry"] = IsWindowsClient(ctx);
|
||||
// windowInfo → get_foreground_window / host_list_windows 的矩形与 activate(SupportsWindowInfo)
|
||||
// windowInfo → get_foreground_window / host_inspect 的 windows 项矩形与 activate(SupportsWindowInfo)
|
||||
caps["windowInfo"] = ctx->SupportsWindowInfo();
|
||||
// privacyOverlay → Android 的 remote_block_input(无障碍 overlay)。Windows 恒可用、
|
||||
// 不声明这个位,所以这里只对「非 Windows 且声明了能力位」的主机为 true。
|
||||
@@ -5251,7 +5251,7 @@ Json::Value BuildRemoteOpenInputSchema() {
|
||||
hwndTypes.append("integer");
|
||||
hwndTypes.append("string");
|
||||
hwndProp["type"] = hwndTypes;
|
||||
hwndProp["description"] = u8"可选:只推该窗口(DWM 可见边框,含标题栏),帧尺寸与归一化坐标都相对该窗口,带宽和点击精度都优于整屏。取 host_list_windows / get_foreground_window 返回的 hwnd(整数或 0x 前缀字符串);最小化窗口会被拒绝(-32009)。与 region 互斥。要求客户端能力位 CLIENT_CAP_WINDOW_INFO(新 Windows 客户端),老客户端返回 -32005。";
|
||||
hwndProp["description"] = u8"可选:只推该窗口(DWM 可见边框,含标题栏),帧尺寸与归一化坐标都相对该窗口,带宽和点击精度都优于整屏。取 host_inspect 的 windows 项 / get_foreground_window 返回的 hwnd(整数或 0x 前缀字符串);最小化窗口会被拒绝(-32009)。与 region 互斥。要求客户端能力位 CLIENT_CAP_WINDOW_INFO(新 Windows 客户端),老客户端返回 -32005。";
|
||||
props["window_hwnd"] = hwndProp;
|
||||
|
||||
Json::Value regionProp(Json::objectValue);
|
||||
@@ -6027,7 +6027,7 @@ static std::string WindowNotFoundErrorJson(const Json::Value& id, uint32_t hwnd,
|
||||
if (truncated)
|
||||
return BuildError(id, -32009, win + " is not in the returned window list, and that list was "
|
||||
"truncated at 96 windows (the host has more visible windows), "
|
||||
"so the window may still exist; verify with host_list_windows "
|
||||
"so the window may still exist; verify with host_inspect "
|
||||
"or use the foreground window");
|
||||
return BuildError(id, -32009, win + " is not in the current visible window list "
|
||||
"(hidden, closed, or not a visible top-level window)");
|
||||
@@ -11782,16 +11782,10 @@ const ToolPlatform kToolPlatforms[] = {
|
||||
{ "create_folder", kPlatWin },
|
||||
{ "list_network_connections", kPlatWin },
|
||||
{ "kill_network_connection", kPlatWin },
|
||||
{ "host_list_processes", kPlatWin },
|
||||
{ "host_list_windows", kPlatWin },
|
||||
{ "host_list_network_state", kPlatWin },
|
||||
{ "host_list_software", kPlatWin },
|
||||
{ "host_list_browser_history", kPlatWin },
|
||||
{ "host_list_favorites", kPlatWin },
|
||||
{ "host_list_win32_services", kPlatWin },
|
||||
{ "host_list_driver_services", kPlatWin },
|
||||
{ "host_list_scheduled_tasks", kPlatWin },
|
||||
{ "host_get_hosts_file", kPlatWin },
|
||||
// P2-1:10 个 host_list_* / host_get_hosts_file 合并为 host_inspect。
|
||||
// 旧名是别名(不进 tools/list,也不进平台表);它们的目标 builder 自己会
|
||||
// ResolveHost(requireWindows=true),所以别名仍然拿得到 -32005。
|
||||
{ "host_inspect", kPlatWin },
|
||||
{ "host_control_process", kPlatWin },
|
||||
{ "host_control_window", kPlatWin },
|
||||
{ "host_control_service", kPlatWin },
|
||||
|
||||
@@ -84,16 +84,8 @@ GATE = {
|
||||
|
||||
# ---- McpMachine 族:总开关 McpMachine ----
|
||||
"list_network_connections": ("machine", False, False),
|
||||
"host_list_processes": ("machine", False, False),
|
||||
"host_list_windows": ("machine", False, False),
|
||||
"host_list_network_state": ("machine", False, False),
|
||||
"host_list_software": ("machine", False, False),
|
||||
"host_list_browser_history": ("machine", False, False),
|
||||
"host_list_favorites": ("machine", False, False),
|
||||
"host_list_win32_services": ("machine", False, False),
|
||||
"host_list_driver_services": ("machine", False, False),
|
||||
"host_list_scheduled_tasks": ("machine", False, False),
|
||||
"host_get_hosts_file": ("machine", False, False),
|
||||
# P2-1:10 个 host_list_* / host_get_hosts_file 合并(旧名为别名,不出现在 tools/list)
|
||||
"host_inspect": ("machine", False, False),
|
||||
"kill_network_connection": ("machine", True, True), # writable && IsManageEnabled()
|
||||
"host_control_process": ("machine", True, False), # writable
|
||||
"host_control_window": ("machine", True, False),
|
||||
@@ -216,16 +208,8 @@ PLATFORMS = {
|
||||
# McpMachine 族(COMMAND_MACHINE_MANAGE 仅 Windows 实现)
|
||||
"list_network_connections": _WIN,
|
||||
"kill_network_connection": _WIN,
|
||||
"host_list_processes": _WIN,
|
||||
"host_list_windows": _WIN,
|
||||
"host_list_network_state": _WIN,
|
||||
"host_list_software": _WIN,
|
||||
"host_list_browser_history": _WIN,
|
||||
"host_list_favorites": _WIN,
|
||||
"host_list_win32_services": _WIN,
|
||||
"host_list_driver_services": _WIN,
|
||||
"host_list_scheduled_tasks": _WIN,
|
||||
"host_get_hosts_file": _WIN,
|
||||
# P2-1:10 个 host_list_* / host_get_hosts_file 合并为 host_inspect(仅 Windows)
|
||||
"host_inspect": _WIN,
|
||||
"host_control_process": _WIN,
|
||||
"host_control_window": _WIN,
|
||||
"host_control_service": _WIN,
|
||||
|
||||
Reference in new issue
Block a user