Skip to content

Commit 19b9360

Browse files
authored
Merge pull request #82 from modelcontextprotocol/fix-callservertool-unwrap
Temporal fix: Handle wrapped JSON-RPC responses in callServerTool
2 parents 3d0a39b + 9743051 commit 19b9360

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/app.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,11 +581,17 @@ export class App extends Protocol<Request, Notification, Result> {
581581
params: CallToolRequest["params"],
582582
options?: RequestOptions,
583583
): Promise<CallToolResult> {
584-
return await this.request(
584+
const response = await this.request(
585585
{ method: "tools/call", params },
586586
CallToolResultSchema,
587587
options,
588588
);
589+
// TEMPORAL HACK: Some host implementations incorrectly return the full
590+
// JSON-RPC envelope instead of just the result. Unwrap if needed.
591+
if (response && "result" in response && "jsonrpc" in response) {
592+
return (response as unknown as { result: CallToolResult }).result;
593+
}
594+
return response;
589595
}
590596

591597
/**

0 commit comments

Comments
 (0)