#[non_exhaustive]pub struct McpCreateMessageResult {
pub model: String,
pub stop_reason: Option<String>,
pub message: SamplingMessage,
}Expand description
Re-exports of the rmcp wire-protocol types this crate now surfaces directly instead of wrapping. Pull these in to pattern-match on tool annotations, content blocks, structured tool output, embedded resources, sampling / elicitation requests, progress and log notifications, etc. Result of sampling/createMessage (SEP-1577). The result of a sampling/createMessage request containing the generated response.
This structure contains the generated message along with metadata about how the generation was performed and why it stopped.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.model: StringThe identifier of the model that generated the response
stop_reason: Option<String>The reason why generation stopped (e.g., “endTurn”, “maxTokens”)
message: SamplingMessageThe generated message with role and content
Implementations§
Source§impl CreateMessageResult
impl CreateMessageResult
pub const STOP_REASON_END_TURN: &'static str = "endTurn"
pub const STOP_REASON_END_SEQUENCE: &'static str = "stopSequence"
pub const STOP_REASON_END_MAX_TOKEN: &'static str = "maxTokens"
pub const STOP_REASON_TOOL_USE: &'static str = "toolUse"
Sourcepub fn new(message: SamplingMessage, model: String) -> CreateMessageResult
pub fn new(message: SamplingMessage, model: String) -> CreateMessageResult
Create a new CreateMessageResult with required fields.
Sourcepub fn with_stop_reason(
self,
stop_reason: impl Into<String>,
) -> CreateMessageResult
pub fn with_stop_reason( self, stop_reason: impl Into<String>, ) -> CreateMessageResult
Set the stop reason.
Sourcepub fn with_model(self, model: impl Into<String>) -> CreateMessageResult
pub fn with_model(self, model: impl Into<String>) -> CreateMessageResult
Set the model identifier.
Trait Implementations§
Source§impl Clone for CreateMessageResult
impl Clone for CreateMessageResult
Source§fn clone(&self) -> CreateMessageResult
fn clone(&self) -> CreateMessageResult
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CreateMessageResult
impl Debug for CreateMessageResult
Source§impl<'de> Deserialize<'de> for CreateMessageResult
impl<'de> Deserialize<'de> for CreateMessageResult
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<CreateMessageResult, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<CreateMessageResult, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for CreateMessageResult
impl PartialEq for CreateMessageResult
Source§fn eq(&self, other: &CreateMessageResult) -> bool
fn eq(&self, other: &CreateMessageResult) -> bool
self and other values to be equal, and is used by ==.