pub trait ElicitationCallback:
Send
+ Sync
+ 'static {
// Required method
fn elicit<'life0, 'async_trait>(
&'life0 self,
context: ElicitationContext,
params: ElicitRequestParams,
) -> Pin<Box<dyn Future<Output = Result<ElicitResult, BoxError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
Handles a server’s request for user input during a tool call (ElicitationCallback).
Any async closure taking the context and the request implements it. A failure is returned to the server as a JSON-RPC error.
use strands::mcp::rmcp::model::{ElicitResult, ElicitationAction};
use strands::mcp::{ElicitationCallback, McpClientOptions};
use std::sync::Arc;
let callback: Arc<dyn ElicitationCallback> = Arc::new(|_context, _params| async {
Ok(ElicitResult::new(ElicitationAction::Decline))
});
let options = McpClientOptions::builder().elicitation_callback(callback).build();
assert!(options.elicitation_callback.is_some());Required Methods§
Sourcefn elicit<'life0, 'async_trait>(
&'life0 self,
context: ElicitationContext,
params: ElicitRequestParams,
) -> Pin<Box<dyn Future<Output = Result<ElicitResult, BoxError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn elicit<'life0, 'async_trait>(
&'life0 self,
context: ElicitationContext,
params: ElicitRequestParams,
) -> Pin<Box<dyn Future<Output = Result<ElicitResult, BoxError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns the user’s answer: accept (with content), decline or cancel.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".