Add a new interface InitToolCallbackResolverErrorHandler as extension for customized actions when ToolCallbackProvider.getToolCallbacks() fail on application starting up #4382
+114
−2
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.
This extension is to fix issue in below scenario for Spring-AI v1.0.1:
Step 1: Application as MCP client that needs to call MCP server in SSE mode.
Step 2: The running MCP server is down, or the network between MCP client and MCP servers is unavailable.
Step 3: When MCP client application starting up, it try to fetch ToolCallbacks immediately from MCP server but failed by reasons in Step 2.
Step 4: MCP client application cannot be start up until problems in Step 2 are resolved.
Below is the related error detail:
Actually, when application starting up, as long as it needs to fetch ToolCallbacks immediately, no matter
(1) by network from any remote server(may be database, mcp server and so on) , or
(2) from local ToolCallbackProvider which has limitation logic that deny getting ToolCallback,
the same issue occurs. (#3232 is similar issue in MCP).
In distributed systems, it is very normal that remote-servers are temporarily unavailable and they should not impact the client-sides start up. As a result, we need a mechanism to let developers decide what actions they prefer to take for the error, or even use other ToolCallbacks as fallback replacement on demand. This is exactly what InitToolCallbackResolverErrorHandler does.
Pls kindly help review and approve this PR. Tks.