CONNECTION
- the resource representing the connection that the transport
manages.public interface McpTransportSession<CONNECTION>
McpSession
type that operates at the level of the JSON-RPC
communication protocol and matches asynchronous responses with previously issued
requests.限定符和类型 | 方法和说明 |
---|---|
void |
addConnection(CONNECTION connection)
Adds a resource that this transport session can monitor and dismiss when needed.
|
void |
close()
Close and clear the monitored resources.
|
org.reactivestreams.Publisher<java.lang.Void> |
closeGracefully()
Close and clear the monitored resources in a graceful manner.
|
boolean |
markInitialized(java.lang.String sessionId)
Stateful operation that flips the un-initialized state to initialized if this is
the first call.
|
void |
removeConnection(CONNECTION connection)
Called when the resource is terminating by itself and the transport session does
not need to track it anymore.
|
java.util.Optional<java.lang.String> |
sessionId()
In case of stateful MCP servers, the value is present and contains the String
identifier for the transport-level session.
|
java.util.Optional<java.lang.String> sessionId()
boolean markInitialized(java.lang.String sessionId)
sessionId
- session identifier as provided by the servertrue
and means that a
post-initialization step can be performedvoid addConnection(CONNECTION connection)
connection
- the managed resourcevoid removeConnection(CONNECTION connection)
connection
- the resource to remove from the monitored collectionvoid close()
org.reactivestreams.Publisher<java.lang.Void> closeGracefully()