-
Notifications
You must be signed in to change notification settings - Fork 11
refactor: deprecate tool pre and post processing hooks to align with cross-SDK architecture #89
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -40,6 +40,7 @@ | |
| import java.util.logging.Logger; | ||
|
|
||
| /** Default implementation using Java 11 HttpClient. */ | ||
| @SuppressWarnings("deprecation") | ||
| public final class McpToolboxClientImpl implements McpToolboxClient { | ||
|
|
||
| /** Logger for logging messages. */ | ||
|
|
@@ -78,10 +79,9 @@ public McpToolboxClientImpl(final Transport clientTransport) { | |
| * Constructs a new McpToolboxClientImpl. | ||
| * | ||
| * @param transport The underlying MCP transport layer. | ||
| * @param headers Fallback headers for deprecated constructor compatibility. | ||
| * @param credentialsProvider Fallback provider for deprecated constructor compatibility. | ||
| * @param headers Default HTTP headers. | ||
| * @param credentialsProvider Provider for credentials. | ||
| */ | ||
| @Deprecated | ||
| public McpToolboxClientImpl( | ||
| Transport transport, Map<String, String> headers, CredentialsProvider credentialsProvider) { | ||
| this(transport, headers, credentialsProvider, null, null); | ||
|
|
@@ -161,14 +161,17 @@ private static CredentialsProvider apiKeyToProvider(final String apiKey) { | |
| } | ||
|
|
||
| /** | ||
| * Primary constructor for McpToolboxClientImpl. | ||
| * Constructs a new McpToolboxClientImpl with pre- and post-processors. | ||
| * | ||
| * @param transport The underlying MCP transport layer. | ||
| * @param headers Default HTTP headers. | ||
| * @param credentialsProvider Provider for credentials. | ||
| * @param preProcessors List of pre-processors. | ||
| * @param postProcessors List of post-processors. | ||
| * @deprecated Use {@link #McpToolboxClientImpl(Transport, Map, CredentialsProvider)} instead. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did we not remove the deprecation from this constructor? I am a bit confused about whether we want to deprecate this or not. |
||
| * Pre- and post-processors are deprecated in favor of orchestration framework callbacks. | ||
| */ | ||
| @Deprecated | ||
| public McpToolboxClientImpl( | ||
| Transport transport, | ||
| Map<String, String> headers, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,6 +32,7 @@ | |
| * Represents a loaded tool ready to be invoked. Handles parameter binding, authentication token | ||
| * resolution, and input validation. | ||
| */ | ||
| @SuppressWarnings("deprecation") | ||
| public class Tool { | ||
| private final String name; | ||
| private final ToolDefinition definition; | ||
|
|
@@ -183,7 +184,9 @@ private static ToolDefinition pruneParameter( | |
| * | ||
| * @param processor The pre-processor to add. | ||
| * @return The tool instance. | ||
| * @deprecated Use orchestration framework callbacks instead of tool-level pre-processors. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this written the other way around? |
||
| */ | ||
| @Deprecated | ||
| public Tool addPreProcessor(final ToolPreProcessor processor) { | ||
| List<ToolPreProcessor> newPre = new ArrayList<>(this.preProcessors); | ||
| newPre.add(processor); | ||
|
|
@@ -202,7 +205,9 @@ public Tool addPreProcessor(final ToolPreProcessor processor) { | |
| * | ||
| * @param processor The post-processor to add. | ||
| * @return A new tool instance with the post-processor added. | ||
| * @deprecated Use orchestration framework callbacks instead of tool-level post-processors. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same, is this written the other way around? |
||
| */ | ||
| @Deprecated | ||
| public Tool addPostProcessor(final ToolPostProcessor processor) { | ||
| List<ToolPostProcessor> newPost = new ArrayList<>(this.postProcessors); | ||
| newPost.add(processor); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,7 +19,14 @@ | |
| import java.util.Map; | ||
| import java.util.concurrent.CompletableFuture; | ||
|
|
||
| /** A functional interface for pre-processing tool inputs before invocation. */ | ||
| /** | ||
| * A functional interface for pre-processing tool inputs before invocation. | ||
| * | ||
| * @deprecated Tool execution hooks are deprecated in the core SDK to align with cross-SDK | ||
| * architecture. Use orchestration framework callbacks (e.g., ADK, LangChain4j, or Spring AI) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. optional: Once we create the pre/post processing doc, can we link that here? |
||
| * for pre-invocation interception. | ||
| */ | ||
| @Deprecated | ||
| @FunctionalInterface | ||
| public interface ToolPreProcessor { | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we removing this deprecation?