-
Notifications
You must be signed in to change notification settings - Fork 2k
Do not inject MCP ToolCallbackProviders into ToolCallbackResolver #4751
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do not inject MCP ToolCallbackProviders into ToolCallbackResolver #4751
Conversation
6c70377 to
8245542
Compare
8245542 to
2608950
Compare
91a2254 to
5cd2988
Compare
- MCP ToolCallbackProviders should not be "resolved" at startup time by
the auto-configuration, ie we don't want to call #getToolCallback
eagerly
- We also want to break the following dependency cycle:
- ChatClient
-> ToolCallingManager
-> ToolCallbackResolver
-> ToolCallbackProvider (incl. SyncMcpToolCallbackProvider)
-> McpSyncClient
-> ClientMcpAnnotatedBeans
-> ChatClient (when there is Sampling)
- This PR ensures that the ToolCallbackResolver does not depend on
SyncMcpToolCallbackProvider, thus breaking the cycle.
- MCP callback providers can still be passed to the chat client, but
only at runtime, not during the configuration phase.
Signed-off-by: Daniel Garnier-Moiroux <[email protected]>
5cd2988 to
93470e7
Compare
| return true; | ||
| } | ||
| var superType = type.getSuperType(); | ||
| return superType != ResolvableType.NONE && isMcpToolCallbackProvider(superType); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After we remove the deprecated constructors It won't have (A)SyncMcpToolCallbackProvider inheritance.
But currently it is possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. We should make these classes final if their constructors are all private.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…backProviders See spring-projectsGH-4751 Signed-off-by: Yanming Zhou <[email protected]>
…backProviders See spring-projectsGH-4751 Signed-off-by: Yanming Zhou <[email protected]>
…nfiguration See spring-projectsGH-4751 Signed-off-by: Yanming Zhou <[email protected]>
…guration See spring-projectsGH-4751 Signed-off-by: Yanming Zhou <[email protected]>
…guration See spring-projectsGH-4751 Signed-off-by: Yanming Zhou <[email protected]>
…backProviders See GH-4751 Signed-off-by: Yanming Zhou <[email protected]>
Description
Breaking change
MCP tools cannot be resolved by name anymore. The following code would not resolve the MCP tool anymore:
Instead you'd have to to: