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

+49 -5
View File
@@ -506,7 +506,7 @@
},
{
"name": "get_screenshot",
"description": "截取指定在线主机的一帧画面,返回 base64 编码的 JPEG 图片(image 对象含 mimeType/data/width/height)。支持 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 里回报实际源矩形与缩放比例。",
"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 里回报实际源矩形与缩放比例。",
"gate": null,
"platforms": [
"win",
@@ -2960,6 +2960,23 @@
"properties": {
"files": {
"items": {
"properties": {
"dir": {
"type": "boolean"
},
"modified": {
"type": "string"
},
"name": {
"type": "string"
},
"path": {
"type": "string"
},
"size": {
"type": "integer"
}
},
"type": "object"
},
"type": "array"
@@ -2967,6 +2984,21 @@
"finished": {
"type": "boolean"
},
"hasMore": {
"type": "boolean"
},
"limit": {
"type": "integer"
},
"offset": {
"type": "integer"
},
"total": {
"type": "integer"
},
"totalAll": {
"type": "integer"
},
"truncated": {
"type": "boolean"
}
@@ -4431,6 +4463,18 @@
],
"impl": "mfc",
"inputSchema": {
"anyOf": [
{
"required": [
"name"
]
},
{
"required": [
"service_name"
]
}
],
"properties": {
"action": {
"description": "start/stop/pause/continue/restart,以及 set_auto/set_manual(转主连接实现,需 McpManage=1)",
@@ -4617,7 +4661,7 @@
"inputSchema": {
"properties": {
"id": {
"description": "主机 id,取 list_online_hosts / search_hosts 返回的 id 字段",
"description": "主机 id,取 list_hosts 返回的 id 字段",
"type": "string"
},
"timeout_ms": {
@@ -4662,7 +4706,7 @@
"inputSchema": {
"properties": {
"id": {
"description": "主机 id,取 list_online_hosts / search_hosts 返回的 id 字段",
"description": "主机 id,取 list_hosts 返回的 id 字段",
"type": "string"
},
"message": {
@@ -4716,7 +4760,7 @@
"inputSchema": {
"properties": {
"id": {
"description": "主机 id,取 list_online_hosts / search_hosts 返回的 id 字段",
"description": "主机 id,取 list_hosts 返回的 id 字段",
"type": "string"
},
"max_messages": {
@@ -4794,7 +4838,7 @@
"inputSchema": {
"properties": {
"id": {
"description": "主机 id,取 list_online_hosts / search_hosts 返回的 id 字段",
"description": "主机 id,取 list_hosts 返回的 id 字段",
"type": "string"
},
"session_id": {