feat: add meta to elicitation results (#792)
This commit is contained in:
parent
be321a4abe
commit
5f432834a1
2 changed files with 80 additions and 5 deletions
|
|
@ -146,6 +146,7 @@ pub trait ClientHandler: Sized + Send + Sync + 'static {
|
|||
/// Ok(CreateElicitationResult {
|
||||
/// action: ElicitationAction::Accept,
|
||||
/// content: Some(user_input),
|
||||
/// meta: None,
|
||||
/// })
|
||||
/// }
|
||||
/// CreateElicitationRequestParam::UrlElicitationParam {meta, message, url, elicitation_id,} => {
|
||||
|
|
@ -154,6 +155,7 @@ pub trait ClientHandler: Sized + Send + Sync + 'static {
|
|||
/// Ok(CreateElicitationResult {
|
||||
/// action: ElicitationAction::Accept,
|
||||
/// content: None,
|
||||
/// meta: None,
|
||||
/// })
|
||||
/// }
|
||||
/// }
|
||||
|
|
@ -171,6 +173,7 @@ pub trait ClientHandler: Sized + Send + Sync + 'static {
|
|||
std::future::ready(Ok(CreateElicitationResult {
|
||||
action: ElicitationAction::Decline,
|
||||
content: None,
|
||||
meta: None,
|
||||
}))
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2699,6 +2699,10 @@ pub struct CreateElicitationResult {
|
|||
/// Only present when action is Accept.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub content: Option<Value>,
|
||||
|
||||
/// Optional protocol-level metadata for this result.
|
||||
#[serde(rename = "_meta", skip_serializing_if = "Option::is_none")]
|
||||
pub meta: Option<Meta>,
|
||||
}
|
||||
|
||||
impl CreateElicitationResult {
|
||||
|
|
@ -2707,6 +2711,7 @@ impl CreateElicitationResult {
|
|||
Self {
|
||||
action,
|
||||
content: None,
|
||||
meta: None,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2715,6 +2720,12 @@ impl CreateElicitationResult {
|
|||
self.content = Some(content);
|
||||
self
|
||||
}
|
||||
|
||||
/// Set the metadata on this result.
|
||||
pub fn with_meta(mut self, meta: Meta) -> Self {
|
||||
self.meta = Some(meta);
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
/// Request type for creating an elicitation to gather user input
|
||||
|
|
|
|||
Loading…
Reference in a new issue