forked from modelcontextprotocol/java-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Sync Fork #2
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
Open
WH77
wants to merge
24
commits into
0.11.0-hubspot
Choose a base branch
from
0.11.0-hubspot-sync
base: 0.11.0-hubspot
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Sync Fork #2
Conversation
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
- The McpSyncServer wraps an async server. By default, reactive operations are scheduled on a bounded-elastic scheduler, to offload blocking work and prevent accidental blocking of non-blocking operations. - With the default behavior, there will be thead ops, even in a blocking context, which means thread-locals from the request thread will be lost. This is inconenvient for frameworks that store state in thread-locals. - This commit adds the ability to avoid offloading, when the user is sure they are executing code in a blocking environment. Work happens in the calling thread, and thread-locals are available throughout the execution.
…ocol#372) - Add BaseMetadata interface with name() and title() methods for consistent metadata handling - The Prompt, PromptArgument, Resource, ResourceTemplate, ResuorceLink, PromptReference, Tool, and Implementation classes implement the BaseMetadata interface, adding a new, optional title field - Update constructors to support backward compatibility while allowing title specification - Modify ResourceContent interface to extend BaseMetadata - Update all test cases to accommodate new title parameter The title field provides human-readable display names optimized for UI contexts, while name remains for programmatic/logical use. This change maintains backward compatibility. Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com> Co-authored-by: Christian Tzolov <christian.tzolov@broadcom.com>
…alizer (modelcontextprotocol#370) - Create new LifecycleInitializer class to handle protocol initialization phase - Move initialization logic from McpAsyncClient to dedicated initializer - Add javadocs for MCP initialization process - Implement protocol version negotiation and capability exchange - Add exception handling for transport session recovery - Include test suite for LifecyleInitializer - Simplify McpAsyncClient by delegating initialization responsibilities This refactoring improves separation of concerns and makes the initialization process more maintainable and testable. Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
Currently, JDK HttpClient SSE implementation incorrectly handles a non-2xx HTTP response code for POST. Instead of immediately failing the caller, it ignores the issue and the user awaits until the timeout kicks in. Set HttpClient to use HTTP/1.1 version explicitly for tests A related problem happened with the WebClient Streamable HTTP implementation, where the error was swallowed for non-400 responses. Signed-off-by: Dariusz Jędrzejczyk <dariusz.jedrzejczyk@broadcom.com>
…llToolRequest (modelcontextprotocol#375) Tool handlers now receive CallToolRequest instead of raw arguments to enable access to additional metadata parameters like progressToken - Deprecate handlers that take only Map<String, Object> arguments - Introduce new handlers that receive the full CallToolRequest object - Maintain backward compatibility with deprecated call handlers - Enhance API to provide access to complete tool request context beyond just arguments - Add builder pattern for AsyncToolSpecification and SyncToolSpecification - Add duplicate tool name validation during server building and runtime registration - Update all test files to use new callTool handlers and builder pattern - Add test coverage for new builder functionality and CallToolRequest handling Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
…rd types As a followup of modelcontextprotocol#372 introduce new constructors to several record types in McpSchema (Resource, ResourceTemplate, Prompt, PromptArgument, Tool, PromptReference, and ResourceLink) to improve backwards compatibility with previous code versions. Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
- Add CompleteContext record to support contextual completion scenarios - Update CompleteRequest to include context and meta fields with backward-compatible constructors - Modify McpAsyncServer to extract and pass context/meta from request parameters - Add tests for context-aware completions including dependent scenarios - Maintain backward compatibility for existing completion handlers Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
…atements Signed-off-by: Sun Yuhan <sunyuhan1998@users.noreply.github.com>
- Include response body in error messages for better debugging - Change sendHttpPost return type from HttpResponse<Void> to HttpResponse<String> - Use BodyHandlers.ofString() instead of discarding response body - Add testErrorOnBogusMessage test to verify error handling for invalid JSON-RPC messages - Test validates that malformed messages return 400 status with descriptive error message Replace modelcontextprotocol#361 Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com> Co-authored-by: jkma <jkma@trip.com>
…ol#357) - Add JsonSchemaValidator interface and DefaultJsonSchemaValidator implementation - put the JsonSchemaValidator classes into a dedicated spec package - add schema caching to DefaultJsonSchemaValidator for better performance - Extend Tool schema to support outputSchema field for defining expected output structure - Add structuredContent field to CallToolResult for validated structured responses - Implement automatic validation of tool outputs against their defined schemas - Add comprehensive test coverage for structured output validation scenarios - Add json-schema-validator and json-unit-assertj dependencies for validation and testing - Update McpServer builders to accept custom JsonSchemaValidator instances - Ensure backward compatibility with existing tools without output schemas This implements the MCP specification requirement that tools with output schemas must provide structured results conforming to those schemas, with automatic validation and error handling for non-conforming outputs. https://modelcontextprotocol.io/specification/2025-06-18/server/tools#structured-content Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
Signed-off-by: Sun Yuhan <sunyuhan1998@users.noreply.github.com>
- Remove unused imports (CallToolResult, TextContent) - Standardize code formatting and indentation throughout - Adjust formatter comments positioning - Improve readability of record definitions and builder classes - Add comprehensive JavaDoc documentation to McpSchema Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
- Add _meta field to all MCP schema records for extensible metadata support - Introduce Result and Notification sealed interfaces for better type organization - Update Request interface to include SubscribeRequest and UnsubscribeRequest - Add backwards-compatible constructors for existing record types - Enhance test coverage for metadata field functionality Breaking change: Modifyibng the Request seald inteface is a breaking change.
…extprotocol#407) Implement progress tracking for long-running operations with: - New ProgressNotification schema and client/server support - Progress consumer handlers in sync/async client builders - Server exchange methods for sending progress updates - Comprehensive integration tests - Backwards compatibility maintained - Add additional tests Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
…redOutputCallToolHandler Follow up to modelcontextprotocol#357 to update tool call handler signature from Map<String, Object> to McpSchema.CallToolRequest for consistency with changes in modelcontextprotocol#375. - Change BiFunction parameter from Map<String, Object> to McpSchema.CallToolRequest for better type safety - Update method signature to accept CallToolRequest instead of raw arguments map - Replace toolSpecification.call() with toolSpecification.callHandler() - Migrate to builder pattern for AsyncToolSpecification construction Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
5ea372c to
0e7e739
Compare
…xtprotocol#413) Addresses issues with servers like Shopify that violate MCP/HTTP specs: - Prioritize application/json in Accept headers to fix content-type issues - Handle non-compliant notification non-empty responses - Add status code validation and null safety improvements Resolves modelcontextprotocol#406 Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
0e7e739 to
e0c4de1
Compare
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.
No description provided.