pub struct HyperRuntime { /* private fields */ }
Implementations§
Source§impl HyperRuntime
impl HyperRuntime
pub async fn create(server: HyperServer) -> SdkResult<Self>
pub fn graceful_shutdown(&self, timeout: Option<Duration>)
pub async fn await_server(self) -> SdkResult<()>
pub async fn runtime_by_session( &self, session_id: &SessionId, ) -> TransportServerResult<Arc<Mutex<Arc<ServerRuntime>>>>
pub async fn send_request( &self, session_id: &SessionId, request: RequestFromServer, timeout: Option<Duration>, ) -> SdkResult<ResultFromClient>
pub async fn send_notification( &self, session_id: &SessionId, notification: NotificationFromServer, ) -> SdkResult<()>
Sourcepub async fn list_roots(
&self,
session_id: &SessionId,
params: Option<ListRootsRequestParams>,
) -> SdkResult<ListRootsResult>
pub async fn list_roots( &self, session_id: &SessionId, params: Option<ListRootsRequestParams>, ) -> SdkResult<ListRootsResult>
Request a list of root URIs from the client. Roots allow servers to ask for specific directories or files to operate on. A common example for roots is providing a set of repositories or directories a server should operate on. This request is typically used when the server needs to understand the file system structure or access specific locations that the client has permission to read from
pub async fn send_logging_message( &self, session_id: &SessionId, params: LoggingMessageNotificationParams, ) -> SdkResult<()>
Sourcepub async fn send_prompt_list_changed(
&self,
session_id: &SessionId,
params: Option<PromptListChangedNotificationParams>,
) -> SdkResult<()>
pub async fn send_prompt_list_changed( &self, session_id: &SessionId, params: Option<PromptListChangedNotificationParams>, ) -> SdkResult<()>
An optional notification from the server to the client, informing it that the list of prompts it offers has changed. This may be issued by servers without any previous subscription from the client.
Sourcepub async fn send_resource_list_changed(
&self,
session_id: &SessionId,
params: Option<ResourceListChangedNotificationParams>,
) -> SdkResult<()>
pub async fn send_resource_list_changed( &self, session_id: &SessionId, params: Option<ResourceListChangedNotificationParams>, ) -> SdkResult<()>
An optional notification from the server to the client, informing it that the list of resources it can read from has changed. This may be issued by servers without any previous subscription from the client.
Sourcepub async fn send_resource_updated(
&self,
session_id: &SessionId,
params: ResourceUpdatedNotificationParams,
) -> SdkResult<()>
pub async fn send_resource_updated( &self, session_id: &SessionId, params: ResourceUpdatedNotificationParams, ) -> SdkResult<()>
A notification from the server to the client, informing it that a resource has changed and may need to be read again. This should only be sent if the client previously sent a resources/subscribe request.
Sourcepub async fn send_tool_list_changed(
&self,
session_id: &SessionId,
params: Option<ToolListChangedNotificationParams>,
) -> SdkResult<()>
pub async fn send_tool_list_changed( &self, session_id: &SessionId, params: Option<ToolListChangedNotificationParams>, ) -> SdkResult<()>
An optional notification from the server to the client, informing it that the list of tools it offers has changed. This may be issued by servers without any previous subscription from the client.
Sourcepub async fn ping(
&self,
session_id: &SessionId,
timeout: Option<Duration>,
) -> SdkResult<Result>
pub async fn ping( &self, session_id: &SessionId, timeout: Option<Duration>, ) -> SdkResult<Result>
A ping request to check that the other party is still alive. The receiver must promptly respond, or else may be disconnected.
This function creates a PingRequest
with no specific parameters, sends the request and awaits the response
Once the response is received, it attempts to convert it into the expected
result type.
§Returns
A SdkResult
containing the rust_mcp_schema::Result
if the request is successful.
If the request or conversion fails, an error is returned.
Sourcepub async fn create_message(
&self,
session_id: &SessionId,
params: CreateMessageRequestParams,
) -> SdkResult<CreateMessageResult>
pub async fn create_message( &self, session_id: &SessionId, params: CreateMessageRequestParams, ) -> SdkResult<CreateMessageResult>
A request from the server to sample an LLM via the client. The client has full discretion over which model to select. The client should also inform the user before beginning sampling, to allow them to inspect the request (human in the loop) and decide whether to approve it.