Skip to content

[Feature][Java] Added retires to remote calls in MCP server#531

Open
yanand0909 wants to merge 3 commits intoapache:mainfrom
yanand0909:add_retries
Open

[Feature][Java] Added retires to remote calls in MCP server#531
yanand0909 wants to merge 3 commits intoapache:mainfrom
yanand0909:add_retries

Conversation

@yanand0909
Copy link
Collaborator

Linked issue: 521

Purpose of change

Add user configurable retries for MCPServer remote calls

Tests

Added retry test and existing UT and IT

API

Yes

Documentation

  • doc-needed
  • doc-not-needed
  • doc-included

@github-actions github-actions bot added priority/major Default priority of the PR or issue. fixVersion/0.2.0 The feature or bug should be implemented/fixed in the 0.2.0 version. doc-needed Your PR changes impact docs. labels Feb 10, 2026
@yanand0909
Copy link
Collaborator Author

Hey @xintongsong, can you take a look at this PR. Thanks

@weiqingy
Copy link
Collaborator

PR title has typo: "retires" should be "retries".

}
String message = e.getMessage();
if (message != null) {
if (message.contains("503")) {
Copy link
Collaborator

@weiqingy weiqingy Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The string-contains check for "503" and "429" could match unrelated messages - e.g., a tool named "room-503-monitor" or an error like "processed 429 items". Would a more specific pattern like "HTTP 503" or a word-boundary check work here? Alternatively, if the MCP SDK throws typed exceptions for HTTP errors, checking the exception type would be more robust.

private static final String FIELD_ENDPOINT = "endpoint";
private static final String FIELD_HEADERS = "headers";
private static final String FIELD_TIMEOUT_SECONDS = "timeoutSeconds";
private static final String FIELD_TIMEOUT = "timeout";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: There seems to be an inconsistency between FIELD_TIMEOUT ("timeout") and the existing FIELD_TIMEOUT_SECONDS ("timeoutSeconds"). The @JsonCreator constructor uses FIELD_TIMEOUT_SECONDS, but the descriptor-based constructor reads FIELD_TIMEOUT. This means the field name used depends on how the MCPServer is constructed (JSON deserialization vs descriptor), which could confuse users. Would it make sense to unify these to a single field name?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc-needed Your PR changes impact docs. fixVersion/0.2.0 The feature or bug should be implemented/fixed in the 0.2.0 version. priority/major Default priority of the PR or issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments