From 3d66fb4523d73ec3aa8b9f76ee0f40dc4f8976d3 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 Hosts may interpose long-running steps (e.g. inline OAuth on 401) between the guest's tools/call and the server's response. Without this, the base SDK's 60s DEFAULT_REQUEST_TIMEOUT_MSEC 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 human-in-the-loop 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 f5f97b37..d3377b1f 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, + { + ...options, + // Hosts may interpose long-running steps (e.g. lazy OAuth) before the + // tool result arrives. Opting in here lets a host heartbeat keep the + // request alive past the 60s default; callers can still override. + onprogress: options?.onprogress ?? (() => {}), + resetTimeoutOnProgress: options?.resetTimeoutOnProgress ?? true, + }, ); }