You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor(mcp): Add ToolContext to MCP metadata conversion
- Introduce ToolContextToMcpMetaConverter interface for converting Spring AI ToolContext to MCP call metadata
- Refactor McpToolCallbackAutoConfiguration to use ObjectProvider for flexible dependency injection
- Remove automatic McpToolNamePrefixGenerator bean creation in favor of ObjectProvider-based resolution
- Add builder pattern for AsyncMcpToolCallback and SyncMcpToolCallback with comprehensive configuration options
- Add builder pattern for AsyncMcpToolCallbackProvider and SyncMcpToolCallbackProvider
- Enhance tool callback call methods to support ToolContext parameter with metadata conversion
- Update MCP tool callbacks to use new CallToolRequest.builder() API
- Improve error handling and logging in tool callback implementations
- Add comprehensive coverage for new builder functionality
- Update documentation with ToolContextToMcpMetaConverter usage examples
- Maintain backward compatibility through deprecation of old constructors
Breaking changes:
- McpToolCallbackAutoConfiguration no longer automatically creates McpToolNamePrefixGenerator bean
- Tool callback constructors are now private, use builder() method instead
Resolves: spring-projects#3505Resolves: spring-projects#2868Resolves: spring-projects#2784Resolves: spring-projects#2620
Replaces: spring-projects#3831
Signed-off-by: Christian Tzolov <[email protected]>
Co-authored-by: YunKui Lu <[email protected]>
Copy file name to clipboardExpand all lines: auto-configurations/mcp/spring-ai-autoconfigure-mcp-client-common/src/main/java/org/springframework/ai/mcp/client/common/autoconfigure/McpToolCallbackAutoConfiguration.java
Copy file name to clipboardExpand all lines: auto-configurations/mcp/spring-ai-autoconfigure-mcp-client-common/src/test/java/org/springframework/ai/mcp/client/common/autoconfigure/McpToolCallbackAutoConfigurationConditionTests.java
Copy file name to clipboardExpand all lines: auto-configurations/mcp/spring-ai-autoconfigure-mcp-client-common/src/test/java/org/springframework/ai/mcp/client/common/autoconfigure/McpToolCallbackAutoConfigurationTests.java
Copy file name to clipboardExpand all lines: auto-configurations/mcp/spring-ai-autoconfigure-mcp-server-common/src/test/java/org/springframework/ai/mcp/server/common/autoconfigure/McpServerAutoConfigurationIT.java
Copy file name to clipboardExpand all lines: auto-configurations/mcp/spring-ai-autoconfigure-mcp-server-common/src/test/java/org/springframework/ai/mcp/server/common/autoconfigure/McpStatelessServerAutoConfigurationIT.java
0 commit comments