Package dev.tachyonmcp.core.runtime
Interface ChannelContext
- All Superinterfaces:
InteractionContext
- All Known Subinterfaces:
DispatchContext
- All Known Implementing Classes:
DefaultChannelContext,DefaultDispatchContext,NoopInteractionContext
Context for an MCP channel, providing access to the protocol, session, and lifecycle.
-
Nested Class Summary
Nested classes/interfaces inherited from interface dev.tachyonmcp.api.runtime.InteractionContext
InteractionContext.Lifecycle -
Method Summary
Modifier and TypeMethodDescriptionvoidenableExtension(String extensionId) Enables an extension for this channel.protocol()Returns the MCP protocol version negotiated for this channel.default StringReturns the protocol version negotiated during initialisation.@Nullable Sessionsession()Returns the current session, ornullif not yet established.default @Nullable StringReturns the session identifier, ornullin stateless mode.voidsetLifecycle(InteractionContext.Lifecycle lifecycle) Sets the lifecycle state for this channel.voidsetSession(@Nullable Session session) Sets the session for this channel.Methods inherited from interface dev.tachyonmcp.api.runtime.InteractionContext
client, get, isExtensionEnabled, lifecycle, notifications, sendRequest, set
-
Method Details
-
protocol
Protocol protocol()Returns the MCP protocol version negotiated for this channel.- Returns:
- the protocol
-
protocolVersion
Description copied from interface:InteractionContextReturns the protocol version negotiated during initialisation.- Specified by:
protocolVersionin interfaceInteractionContext- Returns:
- the negotiated protocol version
-
session
@Nullable Session session()Returns the current session, ornullif not yet established.- Returns:
- the session, or
null
-
sessionId
Description copied from interface:InteractionContextReturns the session identifier, ornullin stateless mode.- Specified by:
sessionIdin interfaceInteractionContext- Returns:
- the session ID, or
null
-
setLifecycle
Sets the lifecycle state for this channel.- Parameters:
lifecycle- the new lifecycle state
-
setSession
Sets the session for this channel.- Parameters:
session- the session, ornullto clear
-
enableExtension
Enables an extension for this channel.- Parameters:
extensionId- the extension identifier
-