pub struct HandlerRegistry {
pub roots: Option<Arc<dyn RootsHandler>>,
pub elicitation: Option<Arc<dyn ElicitationHandler>>,
pub log: Option<Arc<dyn LogHandler>>,
pub resource_update: Option<Arc<dyn ResourceUpdateHandler>>,
pub cancellation: Option<Arc<dyn CancellationHandler>>,
pub resource_list_changed: Option<Arc<dyn ResourceListChangedHandler>>,
pub prompt_list_changed: Option<Arc<dyn PromptListChangedHandler>>,
pub tool_list_changed: Option<Arc<dyn ToolListChangedHandler>>,
}Expand description
Registry for managing client-side handlers
This registry holds all the handler implementations and provides methods for registering and invoking them. It’s used internally by the Client to dispatch server-initiated requests to the appropriate handlers.
Fields§
§roots: Option<Arc<dyn RootsHandler>>Roots handler for filesystem root requests
elicitation: Option<Arc<dyn ElicitationHandler>>Elicitation handler for user input requests
log: Option<Arc<dyn LogHandler>>Log handler for server log messages
resource_update: Option<Arc<dyn ResourceUpdateHandler>>Resource update handler for resource change notifications
cancellation: Option<Arc<dyn CancellationHandler>>Cancellation handler for cancellation notifications
resource_list_changed: Option<Arc<dyn ResourceListChangedHandler>>Resource list changed handler
prompt_list_changed: Option<Arc<dyn PromptListChangedHandler>>Prompt list changed handler
tool_list_changed: Option<Arc<dyn ToolListChangedHandler>>Tool list changed handler
Implementations§
Source§impl HandlerRegistry
impl HandlerRegistry
Sourcepub fn set_roots_handler(&mut self, handler: Arc<dyn RootsHandler>)
pub fn set_roots_handler(&mut self, handler: Arc<dyn RootsHandler>)
Register a roots handler
Sourcepub fn set_elicitation_handler(&mut self, handler: Arc<dyn ElicitationHandler>)
pub fn set_elicitation_handler(&mut self, handler: Arc<dyn ElicitationHandler>)
Register an elicitation handler
Sourcepub fn set_log_handler(&mut self, handler: Arc<dyn LogHandler>)
pub fn set_log_handler(&mut self, handler: Arc<dyn LogHandler>)
Register a log handler
Sourcepub fn set_resource_update_handler(
&mut self,
handler: Arc<dyn ResourceUpdateHandler>,
)
pub fn set_resource_update_handler( &mut self, handler: Arc<dyn ResourceUpdateHandler>, )
Register a resource update handler
Sourcepub fn set_cancellation_handler(
&mut self,
handler: Arc<dyn CancellationHandler>,
)
pub fn set_cancellation_handler( &mut self, handler: Arc<dyn CancellationHandler>, )
Register a cancellation handler
Sourcepub fn set_resource_list_changed_handler(
&mut self,
handler: Arc<dyn ResourceListChangedHandler>,
)
pub fn set_resource_list_changed_handler( &mut self, handler: Arc<dyn ResourceListChangedHandler>, )
Register a resource list changed handler
Sourcepub fn set_prompt_list_changed_handler(
&mut self,
handler: Arc<dyn PromptListChangedHandler>,
)
pub fn set_prompt_list_changed_handler( &mut self, handler: Arc<dyn PromptListChangedHandler>, )
Register a prompt list changed handler
Sourcepub fn set_tool_list_changed_handler(
&mut self,
handler: Arc<dyn ToolListChangedHandler>,
)
pub fn set_tool_list_changed_handler( &mut self, handler: Arc<dyn ToolListChangedHandler>, )
Register a tool list changed handler
Sourcepub fn has_roots_handler(&self) -> bool
pub fn has_roots_handler(&self) -> bool
Check if a roots handler is registered
Sourcepub fn has_elicitation_handler(&self) -> bool
pub fn has_elicitation_handler(&self) -> bool
Check if an elicitation handler is registered
Sourcepub fn has_log_handler(&self) -> bool
pub fn has_log_handler(&self) -> bool
Check if a log handler is registered
Sourcepub fn has_resource_update_handler(&self) -> bool
pub fn has_resource_update_handler(&self) -> bool
Check if a resource update handler is registered
Sourcepub fn get_log_handler(&self) -> Option<Arc<dyn LogHandler>>
pub fn get_log_handler(&self) -> Option<Arc<dyn LogHandler>>
Get the log handler if registered
Sourcepub fn get_resource_update_handler(
&self,
) -> Option<Arc<dyn ResourceUpdateHandler>>
pub fn get_resource_update_handler( &self, ) -> Option<Arc<dyn ResourceUpdateHandler>>
Get the resource update handler if registered
Sourcepub fn get_cancellation_handler(&self) -> Option<Arc<dyn CancellationHandler>>
pub fn get_cancellation_handler(&self) -> Option<Arc<dyn CancellationHandler>>
Get the cancellation handler if registered
Sourcepub fn get_resource_list_changed_handler(
&self,
) -> Option<Arc<dyn ResourceListChangedHandler>>
pub fn get_resource_list_changed_handler( &self, ) -> Option<Arc<dyn ResourceListChangedHandler>>
Get the resource list changed handler if registered
Sourcepub fn get_prompt_list_changed_handler(
&self,
) -> Option<Arc<dyn PromptListChangedHandler>>
pub fn get_prompt_list_changed_handler( &self, ) -> Option<Arc<dyn PromptListChangedHandler>>
Get the prompt list changed handler if registered
Sourcepub fn get_tool_list_changed_handler(
&self,
) -> Option<Arc<dyn ToolListChangedHandler>>
pub fn get_tool_list_changed_handler( &self, ) -> Option<Arc<dyn ToolListChangedHandler>>
Get the tool list changed handler if registered
Sourcepub async fn handle_roots_request(&self) -> HandlerResult<Vec<Root>>
pub async fn handle_roots_request(&self) -> HandlerResult<Vec<Root>>
Handle a roots/list request from the server
Sourcepub async fn handle_elicitation(
&self,
request: ElicitationRequest,
) -> HandlerResult<ElicitationResponse>
pub async fn handle_elicitation( &self, request: ElicitationRequest, ) -> HandlerResult<ElicitationResponse>
Handle an elicitation request
Sourcepub async fn handle_log(&self, log: LoggingNotification) -> HandlerResult<()>
pub async fn handle_log(&self, log: LoggingNotification) -> HandlerResult<()>
Handle a log message
Sourcepub async fn handle_resource_update(
&self,
notification: ResourceUpdatedNotification,
) -> HandlerResult<()>
pub async fn handle_resource_update( &self, notification: ResourceUpdatedNotification, ) -> HandlerResult<()>
Handle a resource update notification