pub struct InputRequired { /* private fields */ }Expand description
An interim result: what the server needs before it can finish.
§Examples
use protocol_droid::application::mcp::input_required::InputRequired;
use protocol_droid::domain::ir::JsonObject;
let ask = JsonObject::new(
r#"{"message":"Name?","requestedSchema":{"type":"object","properties":{"name":{"type":"string"}}}}"#,
)?;
let result = InputRequired::new().elicit("user_name", &ask).into_result();
assert!(result.as_str().contains(r#""resultType":"input_required""#));Implementations§
Source§impl InputRequired
impl InputRequired
Sourcepub fn elicit(self, key: impl Into<String>, params: &JsonObject) -> Self
pub fn elicit(self, key: impl Into<String>, params: &JsonObject) -> Self
Asks the client’s user for input, under key.
Sourcepub fn sample(self, key: impl Into<String>, params: &JsonObject) -> Self
pub fn sample(self, key: impl Into<String>, params: &JsonObject) -> Self
Asks the client to sample from a model, under key.
Sourcepub fn list_roots(self, key: impl Into<String>) -> Self
pub fn list_roots(self, key: impl Into<String>) -> Self
Asks the client for its roots, under key.
Sourcepub fn with_state(self, sealed: impl Into<String>) -> Self
pub fn with_state(self, sealed: impl Into<String>) -> Self
Carries a sealed requestState the client will echo on its retry.
Takes the sealed form — see
RequestContext::seal_state.
Sourcepub fn into_result(self) -> JsonObject
pub fn into_result(self) -> JsonObject
The result document.
resultType is written here rather than left to the dispatcher’s
envelope, because it is what makes this an interim result at all: the
envelope stamps "complete" on anything that does not already say
otherwise.
Trait Implementations§
Source§impl Clone for InputRequired
impl Clone for InputRequired
Source§impl Debug for InputRequired
impl Debug for InputRequired
Auto Trait Implementations§
impl Freeze for InputRequired
impl RefUnwindSafe for InputRequired
impl Send for InputRequired
impl Sync for InputRequired
impl Unpin for InputRequired
impl UnsafeUnpin for InputRequired
impl UnwindSafe for InputRequired
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more