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.
This commit is contained in:
parent
4f4dd8b6f0
commit
c59c6060cd
1 changed files with 8 additions and 1 deletions
|
|
@ -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,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue