diff --git a/auto-configurations/mcp/spring-ai-autoconfigure-mcp-client/src/main/java/org/springframework/ai/mcp/client/autoconfigure/properties/McpClientCommonProperties.java b/auto-configurations/mcp/spring-ai-autoconfigure-mcp-client/src/main/java/org/springframework/ai/mcp/client/autoconfigure/properties/McpClientCommonProperties.java index d63f19241..475c09313 100644 --- a/auto-configurations/mcp/spring-ai-autoconfigure-mcp-client/src/main/java/org/springframework/ai/mcp/client/autoconfigure/properties/McpClientCommonProperties.java +++ b/auto-configurations/mcp/spring-ai-autoconfigure-mcp-client/src/main/java/org/springframework/ai/mcp/client/autoconfigure/properties/McpClientCommonProperties.java @@ -18,6 +18,9 @@ package org.springframework.ai.mcp.client.autoconfigure.properties; import java.time.Duration; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + import org.springframework.boot.context.properties.ConfigurationProperties; /** @@ -25,6 +28,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties; * all transport types. * * @author Christian Tzolov + * @author Yangki Zhang * @since 1.0.0 */ @ConfigurationProperties(McpClientCommonProperties.CONFIG_PREFIX) @@ -101,6 +105,32 @@ public class McpClientCommonProperties { */ private boolean rootChangeNotification = true; + /** + * Tool callback configuration. + *

+ * This configuration is used to enable or disable tool callbacks in the MCP client. + */ + private Toolcallback toolcallback = new Toolcallback(false); + + /** + * Represents a callback configuration for tools. + *

+ * This record is used to encapsulate the configuration for enabling or disabling tool + * callbacks in the MCP client. + * + * @param enabled A boolean flag indicating whether the tool callback is enabled. If + * true, the tool callback is active; otherwise, it is disabled. + */ + @JsonInclude(JsonInclude.Include.NON_ABSENT) + public record Toolcallback( + + /** + * A boolean flag indicating whether the tool callback is enabled. If true, + * the tool callback is active; otherwise, it is disabled. + */ + @JsonProperty("enabled") boolean enabled) { + } + public boolean isEnabled() { return this.enabled; } @@ -157,4 +187,12 @@ public class McpClientCommonProperties { this.rootChangeNotification = rootChangeNotification; } + public Toolcallback getToolcallback() { + return toolcallback; + } + + public void setToolcallback(Toolcallback toolcallback) { + this.toolcallback = toolcallback; + } + }