Repository navigation
fix(llm): retry a read-only or idempotent MCP tool call once after a dropped connection - #207
Merged
Merged
Conversation
…dropped connection A tools/call that failed on a dead connection returned 'unavailable' although the request never reached the server and the source reconnected 100 ms later. Retry once on the new client when the tool's annotations mark it readOnlyHint or idempotentHint, within the remaining per-call timeout; log the error cause class and code.
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A
tools/callthat failed on a dropped connection (TypeError: fetch failed) returnedtool <name> failed: unavailable, even though the request never reached the server and the source reconnected about 100 ms later. The model then told the caller it could not reach the tool.McpToolSource.callTool: after a transport error, when the tool'sannotationsfromtools/listhasreadOnlyHint === trueoridempotentHint === true, wait for the reconnect within the call's remaining timeout and send the call once more on the new client. Unannotated tools keep one attempt andunavailable. A tool's ownisErrorresult and JSON-RPC errors are never retried.McpToolInfo.annotationskeeps the two hints fromtools/list.mcp source connection lostlog line addscause(class) andcauseCodeof the fetch error. No arguments or results are logged.test/llm/mcp/mcp-tool-source-retry.test.ts.Verified locally and via CI; no extra manual steps.