-
Notifications
You must be signed in to change notification settings - Fork 566
Support Progress Flow for McpClient #389
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
134130
wants to merge
16
commits into
modelcontextprotocol:main
from
134130:cooper/client-progress-support
+180
−12
Closed
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
dc4f83e
Add docs and message field for ProgressNotification
134130 a675e8c
add notifications/progress constant
134130 705c70f
Make server can handle _meta field and send notification to client
134130 aa95c0d
Add JSON deserialization test
134130 a88c241
Implement for client
134130 bdfb4b5
add test
134130 26fe022
Merge remote-tracking branch 'origin/main' into feat/#298
134130 3b1b00a
fix: use static ProgressNotification type reference
134130 17186c0
fix: correct parameter name from '_meta' to 'meta' in method document…
134130 efb4f2e
fix: replace general notification method to specific method: progress…
134130 d7e0732
fix: restore unintended changes from merge commit
134130 e23b897
fix: restore client changes
134130 283f8f5
fix: restore integration test
134130 8b43c34
fix: restore McpSchemaTests because of duplicating
134130 a1266cd
feat: Client implementation
134130 446c633
feat: Add tests
134130 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,7 @@ | |
import io.modelcontextprotocol.util.Assert; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import reactor.util.annotation.Nullable; | ||
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. Remove the reactor.util.annotation.Nullable; |
||
|
||
/** | ||
* Based on the <a href="http://www.jsonrpc.org/specification">JSON-RPC 2.0 | ||
|
@@ -58,6 +59,8 @@ private McpSchema() { | |
|
||
public static final String METHOD_PING = "ping"; | ||
|
||
public static final String METHOD_NOTIFICATION_PROGRESS = "notifications/progress"; | ||
|
||
// Tool Methods | ||
public static final String METHOD_TOOLS_LIST = "tools/list"; | ||
|
||
|
@@ -249,7 +252,7 @@ public record InitializeRequest( // @formatter:off | |
@JsonProperty("capabilities") ClientCapabilities capabilities, | ||
@JsonProperty("clientInfo") Implementation clientInfo, | ||
@JsonProperty("_meta") Map<String, Object> meta) implements Request { | ||
|
||
public InitializeRequest(String protocolVersion, ClientCapabilities capabilities, Implementation clientInfo) { | ||
this(protocolVersion, capabilities, clientInfo, null); | ||
} | ||
|
@@ -462,7 +465,7 @@ public ServerCapabilities build() { | |
public record Implementation(// @formatter:off | ||
@JsonProperty("name") String name, | ||
@JsonProperty("title") String title, | ||
@JsonProperty("version") String version) implements BaseMetadata {// @formatter:on | ||
@JsonProperty("version") String version) implements BaseMetadata {// @formatter:on | ||
|
||
public Implementation(String name, String version) { | ||
this(name, null, version); | ||
|
@@ -1053,6 +1056,8 @@ private static JsonSchema parseSchema(String schema) { | |
* tools/list. | ||
* @param arguments Arguments to pass to the tool. These must conform to the tool's | ||
* input schema. | ||
* @param meta Optional metadata about the request. This can include additional | ||
* information like `progressToken` | ||
*/ | ||
@JsonInclude(JsonInclude.Include.NON_ABSENT) | ||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
|
@@ -1063,9 +1068,10 @@ public record CallToolRequest(// @formatter:off | |
|
||
public CallToolRequest(String name, String jsonArguments) { | ||
this(name, parseJsonArguments(jsonArguments), null); | ||
} | ||
public CallToolRequest(String name, Map<String, Object> arguments) { | ||
this(name, arguments, null); | ||
} | ||
|
||
public CallToolRequest(String name, Map<String, Object> arguments) { | ||
this(name, arguments, null); | ||
} | ||
|
||
private static Map<String, Object> parseJsonArguments(String jsonArguments) { | ||
|
@@ -1317,7 +1323,7 @@ public record CreateMessageRequest(// @formatter:off | |
@JsonProperty("metadata") Map<String, Object> metadata, | ||
@JsonProperty("_meta") Map<String, Object> meta) implements Request { | ||
|
||
|
||
// backwards compatibility constructor | ||
public CreateMessageRequest(List<SamplingMessage> messages, ModelPreferences modelPreferences, | ||
String systemPrompt, ContextInclusionStrategy includeContext, | ||
|
@@ -1771,7 +1777,7 @@ public CompleteRequest(McpSchema.CompleteReference ref, CompleteArgument argumen | |
public CompleteRequest(McpSchema.CompleteReference ref, CompleteArgument argument) { | ||
this(ref, argument, null, null); | ||
} | ||
|
||
public record CompleteArgument( | ||
@JsonProperty("name") String name, | ||
@JsonProperty("value") String value) { | ||
|
Oops, something went wrong.
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.
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.
This needs to be mirrored in the McpSyncServerExchange