Fix(mcp): align Go tool text and list_files batch with Win32

The Go minimal server sent models after tools it does not have: read_file
pointed at download_file and search_file, both absent from its nine-tool
set, and the 2 MiB message named a download path that does not exist. It
now names list_files, terminal_exec and the Windows controller server.

Terminal errors lost the one piece of state the model needs to recover.
A busy terminal now says the holder is the web console (no MCP session to
close), and a cancelled exec carries the session_id to poll or release.

list_files ids[] was advertised in the shared schema but answered -32005.
It now implements the Win32 batch contract: 50 ids, ids past the 50 s
deadline marked skipped rather than failed, results in input order. The
deadline only gates starting a host; one already running finishes on its
own timeout, so its result is never mislabelled as a client abort. Each
entry takes the per-device lock the single-host path gets, so a host busy
with another tool fails that entry with -32003 instead of running beside
it. An empty ids array is a valid empty batch, as on Win32.

The initialize instructions now describe only what this build implements.

Co-Authored-By: deepseek-flash
This commit is contained in:
yuanyuanxianganddeepseek-flash committed 2026-11-13 12:57:12 +01:00
1 parent 61b9031269
commit 31883edc09
6 files changed
+433 -32

No files matched your search

+6 -4
View File
@@ -310,7 +310,7 @@ func (t *transferSession) acceptChunk(ctx *connection.Context, transferID uint64
return
}
if flags&ffV2Directory != 0 {
t.fail(CodeInvalidParams, "Not a single regular file (directory or multiple matches): %s — use list_files / search_file to pick a specific file", t.remotePath)
t.fail(CodeInvalidParams, "Not a single regular file (directory or multiple matches): %s — use list_files to pick a specific file", t.remotePath)
return
}
rel, ok := transferNameWithinDir(t.targetDir, nameStr)
@@ -328,12 +328,14 @@ func (t *transferSession) acceptChunk(ctx *connection.Context, transferID uint64
// were the answer. totalFiles == 0 means "not reported": older senders
// may leave it unset, and a single file is still the only valid read.
if totalFiles > 1 {
t.fail(CodeInvalidParams, "Not a single regular file (directory or multiple matches): %s — use list_files / search_file to pick a specific file", t.remotePath)
t.fail(CodeInvalidParams, "Not a single regular file (directory or multiple matches): %s — use list_files to pick a specific file", t.remotePath)
return
}
if fileSize > t.maxFileBytes {
t.fail(CodeInvalidParams,
"File is larger than %d bytes: use download_file to fetch it (%s)", t.maxFileBytes, t.remotePath)
"File is larger than %d bytes: this minimal server has no download_file; read it in parts with "+
"terminal_exec (type/tail/Get-Content) or use the Windows controller server (%s)",
t.maxFileBytes, t.remotePath)
return
}
if offset != 0 {
@@ -353,7 +355,7 @@ func (t *transferSession) acceptChunk(ctx *connection.Context, transferID uint64
t.haveFile = true
} else if fileIndex != t.fileIndex {
// A second file index means the remote path matched more than one file.
t.fail(CodeInvalidParams, "Not a single regular file (directory or multiple matches): %s — use list_files / search_file to pick a specific file", t.remotePath)
t.fail(CodeInvalidParams, "Not a single regular file (directory or multiple matches): %s — use list_files to pick a specific file", t.remotePath)
return
}