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:
1 parent
5e012019ba
commit
292c3191dc
7 files changed
+93
-23
No files matched your search
+2
-2
@@ -265,7 +265,7 @@ $auditFiltered = Rpc '' $null 'get_audit_log' @{ type = 'zzz-no-such-type'; limi
|
||||
Check 'get_audit_log 过滤未命中返回 0 条' ($auditFiltered.error -eq $null -and @($auditFiltered.result.structuredContent.entries).Count -eq 0)
|
||||
|
||||
$status = Rpc '' $null 'get_server_status' @{}
|
||||
$st = $status.result.structuredContent.status
|
||||
$st = $status.result.structuredContent
|
||||
Check 'get_server_status 正常返回' ($status.error -eq $null -and $null -ne $st)
|
||||
$basePort = 6544
|
||||
if ($Base -match ':(\d+)(/|$)') { $basePort = [int]$Matches[1] }
|
||||
@@ -806,7 +806,7 @@ if (-not $longCall) {
|
||||
([int]$jr.error.code -eq -32800)) $body
|
||||
|
||||
# 交叉核对:get_server_status 的 sessions.pending 应回到 0,主机能再次正常调用
|
||||
$st2 = (Rpc '' $null 'get_server_status' @{}).result.structuredContent.status
|
||||
$st2 = (Rpc '' $null 'get_server_status' @{}).result.structuredContent
|
||||
Check '取消后 get_server_status 无挂起(sessions.pending=0)' `
|
||||
([int]$st2.sessions.pending -eq 0) ("pending=" + $st2.sessions.pending)
|
||||
if (HasTool 'list_processes') {
|
||||
|
||||
Reference in new issue
Block a user