ServerSession
Represents an active server-side session in the Model Context Protocol.
Owns the server side of a single client connection on top of Protocol. Drives the initialize/initialized handshake, tracks the negotiated client capabilities and version, asserts capability requirements before dispatching requests and notifications, and exposes server-to-client operations such as sampling, root listing, elicitation, logging, and list-change notifications.
Equality and hashing are based on sessionId, so a session can be used as a key in routing structures.
Parameters
server capabilities and protocol options used by Protocol
Properties
Capabilities reported by the client during initialization, or null before the handshake completes.
Client implementation information reported during initialization, or null before the handshake completes.
Functions
Asserts that the server can handle the specified request method.
Sends a message to the client requesting an elicitation. This typically results in a form being displayed to the end user.
Sends a URL mode elicitation request to the client, directing the user to an external URL for out-of-band interactions.
Creates a message using the server's sampling capability.
Lists the available "roots" from the client's perspective (if supported).
Registers a callback to be invoked when the server has completed initialization.
Sends a ping request to the client to check connectivity.
Sends a notification to the client indicating that an out-of-band elicitation has completed.
Sends a logging message notification to the client. Messages are filtered based on the current logging level set by the client. If no logging level is set, all messages are sent.
Sends a notification to the client indicating that the list of prompts has changed.
Sends a notification to the client indicating that the list of resources has changed.
Sends a resource-updated notification to the client, indicating that a specific resource has changed.
Sends a notification to the client indicating that the list of tools has changed.