feat: add pre & post processing hooks for tools#58
Merged
stenalpjolly merged 23 commits intoJun 25, 2026
Merged
Conversation
6f1dbf4 to
207591b
Compare
Contributor
|
/gcbrun |
5 similar comments
Contributor
Author
|
/gcbrun |
Contributor
Author
|
/gcbrun |
Contributor
Author
|
/gcbrun |
Contributor
Author
|
/gcbrun |
Contributor
Author
|
/gcbrun |
anubhav756
requested changes
Jun 19, 2026
anubhav756
requested changes
Jun 19, 2026
anubhav756
left a comment
Contributor
There was a problem hiding this comment.
Might cause conflicts with #65.
Contributor
Author
|
I have addressed the PR review comment:
|
fa6f3c9 to
b6fbb40
Compare
…ve integration test failures
* Supported readOnlyHint and destructiveHint in ToolDefinition (with backward compatible constructors) * Deep copied complex default parameter values before injection to prevent mutability side effects
…t layer and add integration tests
…s and extraHeaders during auth token resolution
… integrate with transport client, and add propagation unit tests
b6fbb40 to
a2a3a56
Compare
…er parsing in transport
anubhav756
approved these changes
Jun 24, 2026
Contributor
|
/gcbrun |
Contributor
Author
|
/gcbrun |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR introduces full support for Tool Pre and Post-processing execution hooks (
ToolPreProcessorandToolPostProcessor) in the Java SDK, fully integrated with the decoupled transport architecture and updated to align with the new thread-safety and token resolution updates.Expectation & Implementation
ToolPreProcessorandToolPostProcessorinstances onMcpToolboxClientBuilder. The client propagates these hooks to all loaded tools duringloadToolsetandloadTool.AuthResolver) introduced in PR refactor: resolve multiple auth tokens concurrently and safely in Tool.execute #65. In addition, local tool execution maps (finalArgsandextraHeaders) are wrapped inCollections.synchronizedMap(...)to prevent any concurrent modifications during async processing.Acceptance criteria
The PR must satisfy the following functional and integration requirements to be accepted:
loadToolsetandloadTool.Test cases
testClientPrePostProcessorsPropagationinMcpToolboxClientImplTestto verify that pre/post-processors registered on the client are successfully propagated to individual tools loaded via bothloadToolsetandloadTool.testProcessorsConfigurationinMcpToolboxClientBuilderTestto verify non-null and null pre/post-processor configuration flows.testDefaultValueDeepCloning_withList,testValidateAndSanitizeArgs_requiredParameterProvided, andtestValidateAndSanitizeArgs_nullTypeWithNonNullValueinToolTestto cover nested structures and parameter boundary checks.Tool,McpToolboxClientBuilder,ResolvedAuth, andMcpToolboxClientImplclasses with 115 passing unit tests.Breaking changes
None.