Trait SamplingHandler
pub trait SamplingHandler: Send + Sync {
// Required method
fn handle_create_message<'life0, 'async_trait>(
&'life0 self,
params: CreateMessageParams,
) -> Pin<Box<dyn Future<Output = Result<CreateMessageResult, McpTransportError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
}Expand description
Handler for MCP sampling/createMessage requests from the server.
When an MCP server sends a sampling/createMessage request during tool
execution, this handler is invoked to route it to an LLM for inference.