pub struct ActixRuntime { /* private fields */ }Expand description
Runtime handle for a running Actix MCP server.
Provides session management, graceful shutdown, and per-session request/notification
methods. Implements McpHttpServer for framework-agnostic usage.
Implementations§
Source§impl ActixRuntime
impl ActixRuntime
Sourcepub async fn create(server: ActixServer) -> SdkResult<Self>
pub async fn create(server: ActixServer) -> SdkResult<Self>
Creates and starts a new runtime from an ActixServer.
Sourcepub fn graceful_shutdown(&self, _timeout: Option<Duration>)
pub fn graceful_shutdown(&self, _timeout: Option<Duration>)
Gracefully stops the server.
Sourcepub async fn await_server(self) -> SdkResult<()>
pub async fn await_server(self) -> SdkResult<()>
Awaits server completion (typically until shutdown).
Sourcepub async fn runtime_by_session(
&self,
session_id: &SessionId,
) -> Result<Arc<ServerRuntime>, McpSdkError>
pub async fn runtime_by_session( &self, session_id: &SessionId, ) -> Result<Arc<ServerRuntime>, McpSdkError>
Returns the runtime for a given session.
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<()>
pub async fn client_info( &self, session_id: &SessionId, ) -> SdkResult<Option<InitializeRequestParams>>
pub async fn request_elicitation( &self, session_id: &SessionId, params: ElicitRequestParams, ) -> SdkResult<ElicitResult>
pub async fn request_root_list( &self, session_id: &SessionId, params: Option<RequestParams>, ) -> SdkResult<ListRootsResult>
pub async fn ping( &self, session_id: &SessionId, params: Option<RequestParams>, timeout: Option<Duration>, ) -> SdkResult<Result>
pub async fn request_message_creation( &self, session_id: &SessionId, params: CreateMessageRequestParams, ) -> SdkResult<CreateMessageResult>
pub async fn request_get_task( &self, session_id: &SessionId, params: GetTaskParams, ) -> SdkResult<GetTaskResult>
pub async fn request_custom( &self, session_id: &SessionId, params: CustomRequest, ) -> SdkResult<GenericResult>
pub async fn notify_log_message( &self, session_id: &SessionId, params: LoggingMessageNotificationParams, ) -> SdkResult<()>
pub async fn notify_tool_list_changed( &self, session_id: &SessionId, params: Option<NotificationParams>, ) -> SdkResult<()>
pub async fn notify_resource_updated( &self, session_id: &SessionId, params: ResourceUpdatedNotificationParams, ) -> SdkResult<()>
pub async fn notify_resource_list_changed( &self, session_id: &SessionId, params: Option<NotificationParams>, ) -> SdkResult<()>
pub async fn notify_prompt_list_changed( &self, session_id: &SessionId, params: Option<NotificationParams>, ) -> SdkResult<()>
pub async fn notify_task_status( &self, session_id: &SessionId, params: TaskStatusNotificationParams, ) -> SdkResult<()>
pub async fn notify_cancellation( &self, session_id: &SessionId, params: CancelledNotificationParams, ) -> SdkResult<()>
pub async fn notify_progress( &self, session_id: &SessionId, params: ProgressNotificationParams, ) -> SdkResult<()>
pub async fn notify_elicitation_completed( &self, session_id: &SessionId, params: ElicitCompleteParams, ) -> SdkResult<()>
pub async fn notify_custom( &self, session_id: &SessionId, params: CustomNotification, ) -> SdkResult<()>
pub async fn request_elicitation_task( &self, session_id: &SessionId, params: ElicitRequestParams, ) -> SdkResult<CreateTaskResult>
pub async fn request_get_task_payload( &self, session_id: &SessionId, params: GetTaskPayloadParams, ) -> SdkResult<ClientTaskResult>
pub async fn request_task_cancellation( &self, session_id: &SessionId, params: CancelTaskParams, ) -> SdkResult<CancelTaskResult>
pub fn task_store(&self) -> Option<Arc<ServerTaskStore>>
pub fn client_task_store(&self) -> Option<Arc<ClientTaskStore>>
pub async fn list_roots( &self, session_id: &SessionId, params: Option<RequestParams>, ) -> SdkResult<ListRootsResult>
👎Deprecated since 0.8.0:
Use request_root_list() instead.
pub async fn elicit_input( &self, session_id: &SessionId, params: ElicitRequestParams, ) -> SdkResult<ElicitResult>
👎Deprecated since 0.8.0:
Use request_elicitation() instead.
pub async fn create_message( &self, session_id: &SessionId, params: CreateMessageRequestParams, ) -> SdkResult<CreateMessageResult>
👎Deprecated since 0.8.0:
Use request_message_creation() instead.
pub async fn send_tool_list_changed( &self, session_id: &SessionId, params: Option<NotificationParams>, ) -> SdkResult<()>
👎Deprecated since 0.8.0:
Use notify_tool_list_changed() instead.
pub async fn send_resource_updated( &self, session_id: &SessionId, params: ResourceUpdatedNotificationParams, ) -> SdkResult<()>
👎Deprecated since 0.8.0:
Use notify_resource_updated() instead.
pub async fn send_resource_list_changed( &self, session_id: &SessionId, params: Option<NotificationParams>, ) -> SdkResult<()>
👎Deprecated since 0.8.0:
Use notify_resource_list_changed() instead.
pub async fn send_prompt_list_changed( &self, session_id: &SessionId, params: Option<NotificationParams>, ) -> SdkResult<()>
👎Deprecated since 0.8.0:
Use notify_prompt_list_changed() instead.
pub async fn send_logging_message( &self, session_id: &SessionId, params: LoggingMessageNotificationParams, ) -> SdkResult<()>
👎Deprecated since 0.8.0:
Use notify_log_message() instead.
Trait Implementations§
Source§impl McpHttpServer for ActixRuntime
impl McpHttpServer for ActixRuntime
Source§fn graceful_shutdown<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn graceful_shutdown<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Gracefully shuts down the server, waiting for in-flight requests to complete.
Source§fn sessions<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Vec<SessionId>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn sessions<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Vec<SessionId>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns all active session IDs on this server.
Source§fn runtime_by_session<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 SessionId,
) -> Pin<Box<dyn Future<Output = SdkResult<Arc<ServerRuntime>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn runtime_by_session<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 SessionId,
) -> Pin<Box<dyn Future<Output = SdkResult<Arc<ServerRuntime>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Returns the runtime for a given session ID. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for ActixRuntime
impl !UnwindSafe for ActixRuntime
impl Freeze for ActixRuntime
impl Send for ActixRuntime
impl Sync for ActixRuntime
impl Unpin for ActixRuntime
impl UnsafeUnpin for ActixRuntime
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more