Repository navigation
[java/google-adk] make MCP protocol errors non-retryable in MCP activities - #668
Merged
brianstrauch merged 3 commits intoNov 19, 2026
Merged
Conversation
…ities A JSON-RPC protocol error a retry cannot fix (parse error, invalid request, method not found, invalid params) now fails the activity non-retryably, as python/google_adk does. Other errors stay retryable.
brianstrauch
left a comment
Member
There was a problem hiding this comment.
One documentation issue on the standard ADK tool-call path.
…ories A factory that initializes its MCP session can hit a JSON-RPC rejection such as INVALID_PARAMS; the factory wrapper now uses the same classifier as listing and tool calls. Transport and startup failures stay retryable.
brianstrauch
enabled auto-merge (squash)
November 19, 2026 00:10
This was referenced Nov 19, 2026
Open
This was referenced Nov 27, 2026
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.
No separate issue: Java sibling of #549 (and #548, #449), which make MCP protocol errors non-retryable in the Python integrations.
Cause.
McpActivitiesImpl.listMcpToolsandcallMcpToolwrap everyRuntimeExceptionin a retryablegoogleadk.McpError. AnMcpErrorfor a request a retry cannot fix (invalid params, invalid request, method not found, parse error) therefore stays retryable and, with the default retry policy, is retried until the policy gives up.Fix. Look up the
McpErroralong the cause chain (the call may wrap it) and, for the JSON-RPC codesPARSE_ERROR,INVALID_REQUEST,METHOD_NOT_FOUNDandINVALID_PARAMS, raise the samegoogleadk.McpErrorfailure as non-retryable, matchingpython/google_adk.INTERNAL_ERROR, transport errors, timeouts and unknown codes stay retryable.FailureTypes.MCP_ERRORdocs updated. The failure type is unchanged, so workflows that match on it keep working. The toolset-factory wrapper uses the same classifier, so a JSON-RPC rejection while a factory initializes its session is classified the same way; startup and transport failures stay retryable.Test.
McpActivitiesImplTestgains cases for each of the four codes (raised by the listing and by thetools/callrequest), an error behind a wrapper exception,INTERNAL_ERRORstaying retryable for both, and a protocol error raised by a toolset factory. The README's MCP failure paragraph is updated.This change was prepared with the help of an AI assistant (Claude) and submitted by the account owner.