xjlgod commented on code in PR #7637:
URL: https://github.com/apache/incubator-seata/pull/7637#discussion_r2365398918
##########
console/src/main/java/io/modelcontextprotocol/server/McpAsyncServerExchange.java:
##########
@@ -0,0 +1,259 @@
+/*
+ * Copyright 2024-2024 the original author or authors.
+ */
+
+package io.modelcontextprotocol.server;
+
+import com.fasterxml.jackson.core.type.TypeReference;
+import io.modelcontextprotocol.spec.McpError;
+import io.modelcontextprotocol.spec.McpLoggableSession;
+import io.modelcontextprotocol.spec.McpSchema;
+import io.modelcontextprotocol.spec.McpSchema.LoggingLevel;
+import io.modelcontextprotocol.spec.McpSchema.LoggingMessageNotification;
+import io.modelcontextprotocol.spec.McpSession;
+import io.modelcontextprotocol.util.Assert;
+import reactor.core.publisher.Mono;
+
+import java.util.ArrayList;
+import java.util.Collections;
+
+/**
+ * Represents an asynchronous exchange with a Model Context Protocol (MCP)
client. The
+ * exchange provides methods to interact with the client and query its
capabilities.
+ *
+ * @author Dariusz Jędrzejczyk
+ * @author Christian Tzolov
+ */
+public class McpAsyncServerExchange {
+
+ private final String sessionId;
+
+ private final McpLoggableSession session;
+
+ private final McpSchema.ClientCapabilities clientCapabilities;
+
+ private final McpSchema.Implementation clientInfo;
+
+ private final McpTransportContext transportContext;
+
+ private static final TypeReference<McpSchema.CreateMessageResult>
CREATE_MESSAGE_RESULT_TYPE_REF =
+ new TypeReference<McpSchema.CreateMessageResult>() {};
+
+ private static final TypeReference<McpSchema.ListRootsResult>
LIST_ROOTS_RESULT_TYPE_REF =
+ new TypeReference<McpSchema.ListRootsResult>() {};
+
+ private static final TypeReference<McpSchema.ElicitResult>
ELICITATION_RESULT_TYPE_REF =
+ new TypeReference<McpSchema.ElicitResult>() {};
+
+ public static final TypeReference<Object> OBJECT_TYPE_REF = new
TypeReference<Object>() {};
+
+ /**
+ * Create a new asynchronous exchange with the client.
+ * @param session The server session representing a 1-1 interaction.
+ * @param clientCapabilities The client capabilities that define the
supported
+ * features and functionality.
+ * @param clientInfo The client implementation information.
+ * @deprecated Use
+ * {@link #McpAsyncServerExchange(String, McpLoggableSession,
McpSchema.ClientCapabilities, McpSchema.Implementation, McpTransportContext)}
+ */
+ @Deprecated
Review Comment:
If you don't need this kind of method, delete it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]