Skip to content

Commit 8c338ed

Browse files
committed
feat(mcp): Add tool callback configuration to MCP client properties
Change-Id: Iefc9de0425ad0654175172b7f0bc220e74e3227b Signed-off-by: 砚池/Ivan <[email protected]>
1 parent c0bc623 commit 8c338ed

File tree

1 file changed

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

1 file changed

+38
-2
lines changed

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

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@
1616

1717
package org.springframework.ai.mcp.client.autoconfigure.properties;
1818

19-
import java.time.Duration;
20-
19+
import com.fasterxml.jackson.annotation.JsonInclude;
20+
import com.fasterxml.jackson.annotation.JsonProperty;
2121
import org.springframework.boot.context.properties.ConfigurationProperties;
2222

23+
import java.time.Duration;
24+
2325
/**
2426
* Common Configuration properties for the Model Context Protocol (MCP) clients shared for
2527
* all transport types.
@@ -101,6 +103,32 @@ public enum ClientType {
101103
*/
102104
private boolean rootChangeNotification = true;
103105

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

188+
public Toolcallback getToolcallback() {
189+
return toolcallback;
190+
}
191+
192+
public void setToolcallback(Toolcallback toolcallback) {
193+
this.toolcallback = toolcallback;
194+
}
195+
160196
}

0 commit comments

Comments
 (0)