From a3867513db2e3996abde1aea9095404693dd9550 Mon Sep 17 00:00:00 2001 From: rl Date: Fri, 3 Apr 2026 19:00:22 -0700 Subject: [PATCH] callServerTool: opt into progress-based timeout reset A host may interpose a long-running or user-interactive step between the guest's tools/call and the server's response. Without this, the base SDK's default request timeout in Protocol.request() fires and the guest sees -32001 even though the host is still working. Passing onprogress causes Protocol.request to include _meta.progressToken in the outgoing request and register a progress handler; resetTimeoutOnProgress makes incoming notifications/progress reset the per-request timer. Hosts can then heartbeat during long-running steps. Callers can still override both. --- src/app.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/app.ts b/src/app.ts index f5f97b37c..4f429e829 100644 --- a/src/app.ts +++ b/src/app.ts @@ -860,7 +860,14 @@ export class App extends ProtocolWithEvents< return await this.request( { method: "tools/call", params }, CallToolResultSchema, - options, + { + // Hosts may interpose long-running or user-interactive steps before the + // tool result arrives. Opting in here lets a host heartbeat keep the + // request alive past the default timeout; callers can still override. + onprogress: () => {}, + resetTimeoutOnProgress: true, + ...options, + }, ); }