Skip to content

Commit c59c606

Browse files
authored
callServerTool: opt into progress-based timeout reset (#600)
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.
1 parent 4f4dd8b commit c59c606

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

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+
// Hosts may interpose long-running or user-interactive steps before the
865+
// tool result arrives. Opting in here lets a host heartbeat keep the
866+
// request alive past the default timeout; callers can still override.
867+
onprogress: () => {},
868+
resetTimeoutOnProgress: true,
869+
...options,
870+
},
864871
);
865872
}
866873

0 commit comments

Comments
 (0)