Log why a tool call failed in the stdio server's log

A failed call's reason went only to the client, so client logs showed a
failure without its cause.
This commit is contained in:
Sameh Khamis committed 2026-10-02 18:29:42 -07:00
1 parent e82ab7440d
commit ae00f009e6
2 files changed
+32 -1

No files matched your search

+5 -1
View File
@@ -54,7 +54,11 @@ async function respond(server, line, log) {
}
const described = describeRequest(message);
if (described) log(described);
return server.handle(message);
const response = await server.handle(message);
// A failed tool call answers the client, not the log; say why here too.
if (response?.result?.isError)
log(` ${described} failed: ${response.result.content?.[0]?.text}`);
return response;
}
/** Read `--api-base <url>` from command-line arguments. */