feat: implement thread-safe synchronous blocking client wrapper#80
Open
stenalpjolly wants to merge 1 commit into
Open
feat: implement thread-safe synchronous blocking client wrapper#80stenalpjolly wants to merge 1 commit into
stenalpjolly wants to merge 1 commit into
Conversation
TAG=agy CONV=c9cedc7f-5a6a-4d32-bf40-6e0ea2d21364
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 pull request implements the thread-safe synchronous blocking client wrapper (
McpToolboxSyncClientandHttpMcpToolboxSyncClient) for the Java SDK, providing an idiomatic blocking interface over the underlying asynchronous (CompletableFuture-based)McpToolboxClient.Dependencies:
McpToolboxException,McpProtocolException,McpTransportException,ToolExecutionException, plus connect/request timeout and custom logger builder options).buildSync()interface and implementation onMcpToolboxClient/McpToolboxClientBuilder, plus transport constructors supporting timeout and logging configurations).Expectation & Implementation
Expectations
.join()or handleCompletionException/CancellationException.McpToolboxExceptionhierarchy.Tool.executeSync).Implementation Details
McpToolboxSyncClientinterface: Defines synchronous counterparts for tool discovery (listTools,loadToolset), tool loading (loadTool), and tool execution (invokeTool).HttpMcpToolboxSyncClientclass: ImplementsMcpToolboxSyncClientby delegating to an underlyingMcpToolboxClientand blocking via.join(). UnwrapsCompletionExceptionandCancellationExceptioncleanly into appropriateMcpToolboxExceptioninstances orIllegalArgumentException.buildSync()toMcpToolboxClient.BuilderandMcpToolboxClientBuilderto constructHttpMcpToolboxSyncClientdirectly.Tool.executeSync(): Added synchronous execution wrapper directly onToolinstances.McpToolboxException(base unchecked exception),McpProtocolException,McpTransportException, andToolExecutionException(from PR 1 dependency foundation).BaseMcpTransportand versioned HTTP transports withconnectTimeout,requestTimeout, and customLoggersupport (activeLogger).README.mdto highlight both async-first and sync-first usage patterns.Test cases
McpToolboxSyncClientTest: Verified constructor validation (nulldelegate checks).McpToolboxSyncClientTest: Verified builder configuration,buildSync(), connect/request timeouts, and custom logger propagation.McpToolboxSyncClientTest: Verified delegation of all synchronous methods (listTools,loadToolset,loadTool,invokeTool).McpToolboxSyncClientTest: Verified comprehensive exception unwrapping (McpToolboxException,IllegalArgumentException, genericException, andnullcause).McpToolboxSyncClientTest: VerifiedTool.executeSync()exception handling and deep-copying support for complexListparameter default values.McpToolboxClientBuilderTest: VerifiedMcpTransportExceptionconstructors and status codes.HttpMcpTransportTest: Verified HTTP request timeout configuration during tool invocation.Acceptance criteria
BUILD SUCCESS.100.00%line coverage achieved onHttpMcpToolboxSyncClient.javaandMcpToolboxSyncClient.java.google-java-formatunder JDK 22+.Breaking changes
TAG=agy
CONV=c9cedc7f-5a6a-4d32-bf40-6e0ea2d21364