macro_rules! elicit_safe {
($($t:ty),* $(,)?) => { ... };
}Available on crate feature
server and (crate features client or server) only.Expand description
Macro to mark types as safe for elicitation by verifying they generate object schemas.
This macro automatically implements the ElicitationSafe trait for struct types
that should be used with elicit<T>() methods.
ยงExample
use rmcp::elicit_safe;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, JsonSchema)]
struct UserProfile {
name: String,
email: String,
}
elicit_safe!(UserProfile);
// Now safe to use in async context:
// let profile: UserProfile = server.elicit("Enter profile").await?;