diff --git a/src/app.ts b/src/app.ts index c6fc931b..5ae64abb 100644 --- a/src/app.ts +++ b/src/app.ts @@ -581,11 +581,17 @@ export class App extends Protocol { params: CallToolRequest["params"], options?: RequestOptions, ): Promise { - return await this.request( + const response = await this.request( { method: "tools/call", params }, CallToolResultSchema, options, ); + // TEMPORAL HACK: Some host implementations incorrectly return the full + // JSON-RPC envelope instead of just the result. Unwrap if needed. + if (response && "result" in response && "jsonrpc" in response) { + return (response as unknown as { result: CallToolResult }).result; + } + return response; } /**