pub trait ResourceListChangedHandler:
Send
+ Sync
+ Debug {
// Required method
fn handle_resource_list_changed<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = HandlerResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
Handler for resource list changes
Per MCP 2025-06-18 specification, notifications/resources/list_changed is
an optional notification from the server to the client, informing it that the
list of resources it can read from has changed.
This notification has no parameters - it simply signals that the client should re-query the server’s resource list if needed.
§Examples
use turbomcp_client::handlers::{ResourceListChangedHandler, HandlerResult};
use async_trait::async_trait;
#[derive(Debug)]
struct MyResourceListHandler;
#[async_trait]
impl ResourceListChangedHandler for MyResourceListHandler {
async fn handle_resource_list_changed(&self) -> HandlerResult<()> {
println!("Server's resource list changed - refreshing...");
// In a real implementation, re-query: client.list_resources().await
Ok(())
}
}Required Methods§
Sourcefn handle_resource_list_changed<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = HandlerResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn handle_resource_list_changed<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = HandlerResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Handle a resource list changed notification
This method is called when the server’s available resource list changes.
§Returns
Returns Ok(()) if the notification was processed successfully.