ClientConnection

Represents a connection interface between a server and a client, enabling communication through notifications, requests, and other operations. This interface defines various methods to facilitate the interaction.

Properties

Link copied to clipboard
abstract val sessionId: String

A unique identifier identifying the current session. Has no inherent meaning.

Functions

Link copied to clipboard
abstract suspend fun createElicitation(request: ElicitRequest, options: RequestOptions? = null): ElicitResult

Sends a message to the client requesting elicitation. This typically results in a form being displayed to the user.

abstract suspend fun createElicitation(message: String, requestedSchema: ElicitRequestParams.RequestedSchema, options: RequestOptions? = null): ElicitResult

Sends a message to the client requesting elicitation. This typically results in a form being displayed to the end user.

abstract suspend fun createElicitation(message: String, elicitationId: String, url: String, options: RequestOptions? = null): ElicitResult

Sends a URL mode elicitation request to the client, directing the user to an external URL for out-of-band interactions.

Link copied to clipboard
abstract suspend fun createMessage(request: CreateMessageRequest, options: RequestOptions? = null): CreateMessageResult

Creates a message using the server's sampling capability.

Link copied to clipboard
abstract suspend fun listRoots(request: ListRootsRequest = ListRootsRequest(), options: RequestOptions? = null): ListRootsResult

Lists the available "roots" from the client's perspective (if supported).

Link copied to clipboard
abstract suspend fun notification(notification: ServerNotification, relatedRequestId: RequestId? = null)

Sends a server-side notification to the client.

Link copied to clipboard
abstract suspend fun ping(request: PingRequest = PingRequest(), options: RequestOptions? = null): EmptyResult

Sends a ping request to the client to check connectivity.

Link copied to clipboard
abstract suspend fun sendElicitationComplete(notification: ElicitationCompleteNotification)

Sends a notification to the client indicating that an out-of-band elicitation has completed.

Link copied to clipboard
abstract suspend fun sendLoggingMessage(notification: LoggingMessageNotification)

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.

Link copied to clipboard
abstract suspend fun sendPromptListChanged()

Sends a notification to the client indicating that the list of prompts has changed.

Link copied to clipboard
abstract suspend fun sendResourceListChanged()

Sends a notification to the client indicating that the list of resources has changed.

Link copied to clipboard
abstract suspend fun sendResourceUpdated(notification: ResourceUpdatedNotification)

Sends a resource-updated notification to the client, indicating that a specific resource has changed.

Link copied to clipboard
abstract suspend fun sendToolListChanged()

Sends a notification to the client indicating that the list of tools has changed.