Skip to content

Commit 6bf980e

Browse files
fix(sep-2243): forward only signal/timeout to the -32001 recovery refresh
The one-refresh-on-HeaderMismatch recovery in callTool() passed the caller's full CallToolRequestOptions to _refreshAllToolDefinitions(), which forwards them to every internal listTools() page. Options like toolDefinition, headers, and onprogress are tools/call-specific and do not apply to tools/list — only the abort signal and timeout should propagate.
1 parent 1bed404 commit 6bf980e

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

packages/client/src/client/client.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1733,7 +1733,7 @@ export class Client extends Protocol<ClientContext> {
17331733
if (!mirroringActive || !isHeaderMismatch || options?.toolDefinition !== undefined) {
17341734
throw error;
17351735
}
1736-
await this._refreshAllToolDefinitions(options).catch(() => {});
1736+
await this._refreshAllToolDefinitions({ signal: options?.signal, timeout: options?.timeout }).catch(() => {});
17371737
result = await this.request({ method: 'tools/call', params }, buildSendOptions());
17381738
}
17391739

@@ -1823,7 +1823,10 @@ export class Client extends Protocol<ClientContext> {
18231823

18241824
/**
18251825
* SEP-2243 internal recovery refresh: walk every `tools/list` page so
1826-
* `_cachedToolDefinitions` is rebuilt completely. The `-32001` retry path
1826+
* `_cachedToolDefinitions` is rebuilt completely. Only the caller's
1827+
* `signal`/`timeout` are forwarded to each page request — `tools/call`
1828+
* options like `toolDefinition`, `headers`, or `onprogress` do not apply
1829+
* to `tools/list`. The `-32001` retry path
18271830
* in {@linkcode callTool} uses this rather than a bare cursor-less
18281831
* `listTools()`, which would only fetch page 1 and (because page 1 clears
18291832
* the merged cache) drop the page-≥2 scans the application accumulated via

0 commit comments

Comments
 (0)