#[non_exhaustive]pub struct SamplingResponse {
pub role: String,
pub content: SamplingContent,
pub model: String,
pub stop_reason: Option<String>,
}Expand description
The sampling/createMessage response envelope returned by an MCP
client. Carries the generated message, the model the client
actually used, and an optional stopReason describing why
generation halted.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.role: StringSpeaker role of the generated message. Typically
"assistant".
content: SamplingContentGenerated content payload.
model: StringIdentifier of the model the client used to generate
content. May differ from any hint the server supplied.
stop_reason: Option<String>Optional reason generation stopped (e.g. "endTurn",
"maxTokens", "stopSequence"). Wire field is
camelCase stopReason.
Trait Implementations§
Source§impl Clone for SamplingResponse
impl Clone for SamplingResponse
Source§fn clone(&self) -> SamplingResponse
fn clone(&self) -> SamplingResponse
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SamplingResponse
impl Debug for SamplingResponse
Source§impl<'de> Deserialize<'de> for SamplingResponse
impl<'de> Deserialize<'de> for SamplingResponse
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for SamplingResponse
impl RefUnwindSafe for SamplingResponse
impl Send for SamplingResponse
impl Sync for SamplingResponse
impl Unpin for SamplingResponse
impl UnsafeUnpin for SamplingResponse
impl UnwindSafe for SamplingResponse
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