feat(mcp): Add tool callback configuration to MCP client properties

Change-Id: Iefc9de0425ad0654175172b7f0bc220e74e3227b
Signed-off-by: 砚池/Ivan <yanchi.zyc@bytedance.com>
This commit is contained in:
砚池/Ivan
2025-04-18 17:46:46 +08:00
committed by Ilayaperumal Gopinathan
parent 5aa22c4187
commit b0d671944a

View File

@@ -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.
* <p>
* 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.
* <p>
* 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;
}
}