Fix(mcp): make declared schemas match what the handlers return

Several tool contracts disagreed with the runtime shape, which forces an
agent to guess instead of following outputSchema:

- get_server_status returned {"status": {...}} while outputSchema has the
  fields at top level; return the status object directly.
- get_screenshot description claimed structuredContent.image carries the
  base64 data; it only carries mimeType/width/height/bytes, the bytes are
  in the content image block.
- host_control_service accepted service_name silently, but not in schema;
  document the alias and add anyOf [{required:[name]},{required:[service_name]}]
  so a call missing both fails at validation, not at execution.
- kill_network_connection dry_run invented dryRun/connection fields absent
  from ActionOutputSchema; use the shared BuildDryRunResult shape.
- search_file outputSchema left files.items untyped; declare
  path/name/modified/dir/size and the paging fields it already emits.
- chat_* id hints still named the removed list_online_hosts/search_hosts.

tools.json hunks keep the live-dump key order (alphabetical inside schemas),
tools_minimal.json is regenerated, and mcp_smoke.ps1 now reads the flat
structuredContent. Debug build green; check_platform_table, gen_go_tools
--check and go test ./... pass.

Co-Authored-By: deepseek-flash
This commit is contained in:
yuanyuanxianganddeepseek-flash committed 2026-11-13 12:23:39 +01:00
1 parent 5e012019ba
commit 292c3191dc
7 files changed
+93 -23

No files matched your search

+2 -2
View File
@@ -628,7 +628,7 @@ token 只从 `-Token` / env 读取,不落仓库、不打印;无在线主机
排查「改动到底生效没有」「为什么某个工具被拒」时,原先只能靠 `list_online_hosts` 加 `get_audit_log` 侧面推断;现在有一个服务端自身的状态快照。纯内存、只读、不建子连接。
返回(`structuredContent.status`):
返回(`structuredContent` 顶层,与 outputSchema 字段一一对应;早期版本曾多包一层 `status`,已修):
| 字段 | 含义 |
|---|---|
@@ -848,7 +848,7 @@ ECDSA 这条是 MS Software KSP 唯一可行的一条,其余几条均已实测
### 14.3 验证
Debug 实例(`Bin\Yama_x64d.exe`,临时端口)实测:`list_all_hosts` 的 `content[1]` 含完整主机 JSON(`id` / `ip` / `last_seen` …),`get_server_status` 的 `content[1]` 是 `{"status":{…}}`,`search_hosts` 空结果时是 `{"hasMore":false,"hosts":[],…}`;`content[0]` 的既有摘要文案一字未改。
Debug 实例(`Bin\Yama_x64d.exe`,临时端口)实测:`list_all_hosts` 的 `content[1]` 含完整主机 JSON(`id` / `ip` / `last_seen` …),`search_hosts` 空结果时是 `{"hasMore":false,"hosts":[],…}`;`content[0]` 的既有摘要文案一字未改。`get_server_status` 的 `content[1]` 是状态对象本身(与 outputSchema 的顶层字段一致;早期版本多包了一层 `status`,已修)。
### 14.4 影响面