Skip to content

Commit b0d6719

Browse files
Ivan97ilayaperumalg
authored andcommitted
feat(mcp): Add tool callback configuration to MCP client properties
Change-Id: Iefc9de0425ad0654175172b7f0bc220e74e3227b Signed-off-by: 砚池/Ivan <[email protected]>
1 parent 5aa22c4 commit b0d6719

File tree

1 file changed

+38
-0
lines changed
  • auto-configurations/mcp/spring-ai-autoconfigure-mcp-client/src/main/java/org/springframework/ai/mcp/client/autoconfigure/properties

1 file changed

+38
-0
lines changed

auto-configurations/mcp/spring-ai-autoconfigure-mcp-client/src/main/java/org/springframework/ai/mcp/client/autoconfigure/properties/McpClientCommonProperties.java

+38
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,17 @@
1818

1919
import java.time.Duration;
2020

21+
import com.fasterxml.jackson.annotation.JsonInclude;
22+
import com.fasterxml.jackson.annotation.JsonProperty;
23+
2124
import org.springframework.boot.context.properties.ConfigurationProperties;
2225

2326
/**
2427
* Common Configuration properties for the Model Context Protocol (MCP) clients shared for
2528
* all transport types.
2629
*
2730
* @author Christian Tzolov
31+
* @author Yangki Zhang
2832
* @since 1.0.0
2933
*/
3034
@ConfigurationProperties(McpClientCommonProperties.CONFIG_PREFIX)
@@ -101,6 +105,32 @@ public enum ClientType {
101105
*/
102106
private boolean rootChangeNotification = true;
103107

108+
/**
109+
* Tool callback configuration.
110+
* <p>
111+
* This configuration is used to enable or disable tool callbacks in the MCP client.
112+
*/
113+
private Toolcallback toolcallback = new Toolcallback(false);
114+
115+
/**
116+
* Represents a callback configuration for tools.
117+
* <p>
118+
* This record is used to encapsulate the configuration for enabling or disabling tool
119+
* callbacks in the MCP client.
120+
*
121+
* @param enabled A boolean flag indicating whether the tool callback is enabled. If
122+
* true, the tool callback is active; otherwise, it is disabled.
123+
*/
124+
@JsonInclude(JsonInclude.Include.NON_ABSENT)
125+
public record Toolcallback(
126+
127+
/**
128+
* A boolean flag indicating whether the tool callback is enabled. If true,
129+
* the tool callback is active; otherwise, it is disabled.
130+
*/
131+
@JsonProperty("enabled") boolean enabled) {
132+
}
133+
104134
public boolean isEnabled() {
105135
return this.enabled;
106136
}
@@ -157,4 +187,12 @@ public void setRootChangeNotification(boolean rootChangeNotification) {
157187
this.rootChangeNotification = rootChangeNotification;
158188
}
159189

190+
public Toolcallback getToolcallback() {
191+
return toolcallback;
192+
}
193+
194+
public void setToolcallback(Toolcallback toolcallback) {
195+
this.toolcallback = toolcallback;
196+
}
197+
160198
}

0 commit comments

Comments
 (0)