Class McpToolCallbackAutoConfiguration
java.lang.Object
org.springframework.ai.mcp.client.common.autoconfigure.McpToolCallbackAutoConfiguration
@AutoConfiguration(after=McpClientAutoConfiguration.class,
beforeName="org.springframework.ai.model.chat.client.autoconfigure.ChatClientAutoConfiguration")
@EnableConfigurationProperties(McpClientCommonProperties.class)
@Conditional(McpToolCallbackAutoConfigurationCondition.class)
public class McpToolCallbackAutoConfiguration
extends Object
Responsible to convert MCP (sync and async) clients into Spring AI
ToolCallbacksProviders. These providers are used by Spring AI to discover and execute
tools.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionmcpAsyncToolCallbacks
(org.springframework.beans.factory.ObjectProvider<McpToolFilter> asyncClientsToolFilter, org.springframework.beans.factory.ObjectProvider<List<io.modelcontextprotocol.client.McpAsyncClient>> mcpClientsProvider, org.springframework.beans.factory.ObjectProvider<McpToolNamePrefixGenerator> toolNamePrefixGenerator, org.springframework.beans.factory.ObjectProvider<ToolContextToMcpMetaConverter> toolContextToMcpMetaConverter) mcpToolCallbacks
(org.springframework.beans.factory.ObjectProvider<McpToolFilter> syncClientsToolFilter, org.springframework.beans.factory.ObjectProvider<List<io.modelcontextprotocol.client.McpSyncClient>> syncMcpClients, org.springframework.beans.factory.ObjectProvider<McpToolNamePrefixGenerator> mcpToolNamePrefixGenerator, org.springframework.beans.factory.ObjectProvider<ToolContextToMcpMetaConverter> toolContextToMcpMetaConverter) Creates tool callbacks for all configured MCP clients.
-
Constructor Details
-
McpToolCallbackAutoConfiguration
public McpToolCallbackAutoConfiguration()
-
-
Method Details
-
defaultMcpToolNamePrefixGenerator
@Bean @ConditionalOnMissingBean public McpToolNamePrefixGenerator defaultMcpToolNamePrefixGenerator() -
mcpToolCallbacks
@Bean @ConditionalOnProperty(prefix="spring.ai.mcp.client", name="type", havingValue="SYNC", matchIfMissing=true) public SyncMcpToolCallbackProvider mcpToolCallbacks(org.springframework.beans.factory.ObjectProvider<McpToolFilter> syncClientsToolFilter, org.springframework.beans.factory.ObjectProvider<List<io.modelcontextprotocol.client.McpSyncClient>> syncMcpClients, org.springframework.beans.factory.ObjectProvider<McpToolNamePrefixGenerator> mcpToolNamePrefixGenerator, org.springframework.beans.factory.ObjectProvider<ToolContextToMcpMetaConverter> toolContextToMcpMetaConverter) Creates tool callbacks for all configured MCP clients.These callbacks enable integration with Spring AI's tool execution framework, allowing MCP tools to be used as part of AI interactions.
- Parameters:
syncClientsToolFilter
- list ofMcpToolFilter
s for the sync client to filter the discovered toolssyncMcpClients
- provider of MCP sync clientsmcpToolNamePrefixGenerator
- the tool name prefix generator- Returns:
- list of tool callbacks for MCP integration
-
mcpAsyncToolCallbacks
@Bean @ConditionalOnProperty(prefix="spring.ai.mcp.client", name="type", havingValue="ASYNC") public AsyncMcpToolCallbackProvider mcpAsyncToolCallbacks(org.springframework.beans.factory.ObjectProvider<McpToolFilter> asyncClientsToolFilter, org.springframework.beans.factory.ObjectProvider<List<io.modelcontextprotocol.client.McpAsyncClient>> mcpClientsProvider, org.springframework.beans.factory.ObjectProvider<McpToolNamePrefixGenerator> toolNamePrefixGenerator, org.springframework.beans.factory.ObjectProvider<ToolContextToMcpMetaConverter> toolContextToMcpMetaConverter)
-