Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -16,10 +16,12 @@

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;

import java.time.Duration;

/**
* Common Configuration properties for the Model Context Protocol (MCP) clients shared for
* all transport types.
@@ -101,6 +103,32 @@ public enum ClientType {
*/
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 +185,12 @@ public void setRootChangeNotification(boolean rootChangeNotification) {
this.rootChangeNotification = rootChangeNotification;
}

public Toolcallback getToolcallback() {
return toolcallback;
}

public void setToolcallback(Toolcallback toolcallback) {
this.toolcallback = toolcallback;
}

}