Skip to main content

ActixRuntime

Struct ActixRuntime 

Source
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

Source

pub async fn create(server: ActixServer) -> SdkResult<Self>

Creates and starts a new runtime from an ActixServer.

Source

pub fn graceful_shutdown(&self, _timeout: Option<Duration>)

Gracefully stops the server.

Source

pub async fn await_server(self) -> SdkResult<()>

Awaits server completion (typically until shutdown).

Source

pub async fn sessions(&self) -> Vec<String>

Returns all active session IDs.

Source

pub async fn runtime_by_session( &self, session_id: &SessionId, ) -> Result<Arc<ServerRuntime>, McpSdkError>

Returns the runtime for a given session.

Source

pub async fn send_request( &self, session_id: &SessionId, request: RequestFromServer, timeout: Option<Duration>, ) -> SdkResult<ResultFromClient>

Source

pub async fn send_notification( &self, session_id: &SessionId, notification: NotificationFromServer, ) -> SdkResult<()>

Source

pub async fn client_info( &self, session_id: &SessionId, ) -> SdkResult<Option<InitializeRequestParams>>

Source

pub async fn request_elicitation( &self, session_id: &SessionId, params: ElicitRequestParams, ) -> SdkResult<ElicitResult>

Source

pub async fn request_root_list( &self, session_id: &SessionId, params: Option<RequestParams>, ) -> SdkResult<ListRootsResult>

Source

pub async fn ping( &self, session_id: &SessionId, params: Option<RequestParams>, timeout: Option<Duration>, ) -> SdkResult<Result>

Source

pub async fn request_message_creation( &self, session_id: &SessionId, params: CreateMessageRequestParams, ) -> SdkResult<CreateMessageResult>

Source

pub async fn request_get_task( &self, session_id: &SessionId, params: GetTaskParams, ) -> SdkResult<GetTaskResult>

Source

pub async fn request_custom( &self, session_id: &SessionId, params: CustomRequest, ) -> SdkResult<GenericResult>

Source

pub async fn notify_log_message( &self, session_id: &SessionId, params: LoggingMessageNotificationParams, ) -> SdkResult<()>

Source

pub async fn notify_tool_list_changed( &self, session_id: &SessionId, params: Option<NotificationParams>, ) -> SdkResult<()>

Source

pub async fn notify_resource_updated( &self, session_id: &SessionId, params: ResourceUpdatedNotificationParams, ) -> SdkResult<()>

Source

pub async fn notify_resource_list_changed( &self, session_id: &SessionId, params: Option<NotificationParams>, ) -> SdkResult<()>

Source

pub async fn notify_prompt_list_changed( &self, session_id: &SessionId, params: Option<NotificationParams>, ) -> SdkResult<()>

Source

pub async fn notify_task_status( &self, session_id: &SessionId, params: TaskStatusNotificationParams, ) -> SdkResult<()>

Source

pub async fn notify_cancellation( &self, session_id: &SessionId, params: CancelledNotificationParams, ) -> SdkResult<()>

Source

pub async fn notify_progress( &self, session_id: &SessionId, params: ProgressNotificationParams, ) -> SdkResult<()>

Source

pub async fn notify_elicitation_completed( &self, session_id: &SessionId, params: ElicitCompleteParams, ) -> SdkResult<()>

Source

pub async fn notify_custom( &self, session_id: &SessionId, params: CustomNotification, ) -> SdkResult<()>

Source

pub async fn request_elicitation_task( &self, session_id: &SessionId, params: ElicitRequestParams, ) -> SdkResult<CreateTaskResult>

Source

pub async fn request_get_task_payload( &self, session_id: &SessionId, params: GetTaskPayloadParams, ) -> SdkResult<ClientTaskResult>

Source

pub async fn request_task_cancellation( &self, session_id: &SessionId, params: CancelTaskParams, ) -> SdkResult<CancelTaskResult>

Source

pub fn task_store(&self) -> Option<Arc<ServerTaskStore>>

Source

pub fn client_task_store(&self) -> Option<Arc<ClientTaskStore>>

Source

pub async fn list_roots( &self, session_id: &SessionId, params: Option<RequestParams>, ) -> SdkResult<ListRootsResult>

👎Deprecated since 0.8.0:

Use request_root_list() instead.

Source

pub async fn elicit_input( &self, session_id: &SessionId, params: ElicitRequestParams, ) -> SdkResult<ElicitResult>

👎Deprecated since 0.8.0:

Use request_elicitation() instead.

Source

pub async fn create_message( &self, session_id: &SessionId, params: CreateMessageRequestParams, ) -> SdkResult<CreateMessageResult>

👎Deprecated since 0.8.0:

Use request_message_creation() instead.

Source

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.

Source

pub async fn send_resource_updated( &self, session_id: &SessionId, params: ResourceUpdatedNotificationParams, ) -> SdkResult<()>

👎Deprecated since 0.8.0:

Use notify_resource_updated() instead.

Source

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.

Source

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.

Source

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

Source§

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,

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,

Returns the runtime for a given session ID. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more