pub trait ToolListChangedHandler:
Send
+ Sync
+ Debug {
// Required method
fn handle_tool_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 tool list changes
Per MCP 2025-06-18 specification, notifications/tools/list_changed is
an optional notification from the server to the client, informing it that the
list of tools it offers has changed.
§Examples
use turbomcp_client::handlers::{ToolListChangedHandler, HandlerResult};
use async_trait::async_trait;
#[derive(Debug)]
struct MyToolListHandler;
#[async_trait]
impl ToolListChangedHandler for MyToolListHandler {
async fn handle_tool_list_changed(&self) -> HandlerResult<()> {
println!("Server's tool list changed - refreshing...");
Ok(())
}
}Required Methods§
Sourcefn handle_tool_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_tool_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 tool list changed notification
This method is called when the server’s available tool list changes.
§Returns
Returns Ok(()) if the notification was processed successfully.