Skip to content

Commit 3d66fb4

Browse files
committed
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.
1 parent 621a70a commit 3d66fb4

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/app.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -860,7 +860,14 @@ export class App extends ProtocolWithEvents<
860860
return await this.request(
861861
{ method: "tools/call", params },
862862
CallToolResultSchema,
863-
options,
863+
{
864+
...options,
865+
// Hosts may interpose long-running steps (e.g. lazy OAuth) before the
866+
// tool result arrives. Opting in here lets a host heartbeat keep the
867+
// request alive past the 60s default; callers can still override.
868+
onprogress: options?.onprogress ?? (() => {}),
869+
resetTimeoutOnProgress: options?.resetTimeoutOnProgress ?? true,
870+
},
864871
);
865872
}
866873

0 commit comments

Comments
 (0)