Package io.modelcontextprotocol.spec
Class McpStreamableServerSession.McpStreamableServerSessionStream
java.lang.Object
io.modelcontextprotocol.spec.McpStreamableServerSession.McpStreamableServerSessionStream
- All Implemented Interfaces:
McpLoggableSession,McpSession
- Enclosing class:
- McpStreamableServerSession
public final class McpStreamableServerSession.McpStreamableServerSessionStream
extends Object
implements McpLoggableSession
An individual SSE stream within a Streamable HTTP context. Can be either the
listening GET SSE stream or a request-specific POST SSE stream.
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor accepting the dedicated transport representing the SSE stream. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes the session and releases any associated resources.reactor.core.publisher.Mono<Void>Closes the session and releases any associated resources asynchronously.booleanisNotificationForLevelAllowed(McpSchema.LoggingLevel loggingLevel) Allows checking whether a particular logging level is allowed.reactor.core.publisher.Mono<Void>sendNotification(String method, Object params) Sends a notification to the model client or server with parameters.<T> reactor.core.publisher.Mono<T>sendRequest(String method, Object requestParams, com.fasterxml.jackson.core.type.TypeReference<T> typeRef) Sends a request to the model counterparty and expects a response of type T.voidsetMinLoggingLevel(McpSchema.LoggingLevel minLoggingLevel) Set the minimum logging level for the client.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.modelcontextprotocol.spec.McpSession
sendNotification
-
Constructor Details
-
McpStreamableServerSessionStream
Constructor accepting the dedicated transport representing the SSE stream.- Parameters:
transport- request-specific SSE transport stream
-
-
Method Details
-
setMinLoggingLevel
Description copied from interface:McpLoggableSessionSet the minimum logging level for the client. Messages below this level will be filtered out.- Specified by:
setMinLoggingLevelin interfaceMcpLoggableSession- Parameters:
minLoggingLevel- The minimum logging level
-
isNotificationForLevelAllowed
Description copied from interface:McpLoggableSessionAllows checking whether a particular logging level is allowed.- Specified by:
isNotificationForLevelAllowedin interfaceMcpLoggableSession- Parameters:
loggingLevel- the level to check- Returns:
- whether the logging at the specified level is permitted.
-
sendRequest
public <T> reactor.core.publisher.Mono<T> sendRequest(String method, Object requestParams, com.fasterxml.jackson.core.type.TypeReference<T> typeRef) Description copied from interface:McpSessionSends a request to the model counterparty and expects a response of type T.This method handles the request-response pattern where a response is expected from the client or server. The response type is determined by the provided TypeReference.
- Specified by:
sendRequestin interfaceMcpSession- Type Parameters:
T- the type of the expected response- Parameters:
method- the name of the method to be called on the counterpartyrequestParams- the parameters to be sent with the requesttypeRef- the TypeReference describing the expected response type- Returns:
- a Mono that will emit the response when received
-
sendNotification
Description copied from interface:McpSessionSends a notification to the model client or server with parameters.Similar to
McpSession.sendNotification(String)but allows sending additional parameters with the notification.- Specified by:
sendNotificationin interfaceMcpSession- Parameters:
method- the name of the notification method to be sent to the counterpartyparams- parameters to be sent with the notification- Returns:
- a Mono that completes when the notification has been sent
-
closeGracefully
Description copied from interface:McpSessionCloses the session and releases any associated resources asynchronously.- Specified by:
closeGracefullyin interfaceMcpSession- Returns:
- a
reactor.core.publisher.Mono<Void>that completes when the session has been closed.
-
close
public void close()Description copied from interface:McpSessionCloses the session and releases any associated resources.- Specified by:
closein interfaceMcpSession
-