pub struct CreateMessageResult {
pub content: CreateMessageContent,
pub meta: Option<MetaObject>,
pub model: String,
pub role: Role,
pub stop_reason: Option<String>,
}Expand description
Latest MCP Protocol 2026_07_28 The result returned by the client for a {@link CreateMessageRequestsampling/createMessage} request. The client should inform the user before returning the sampled message, to allow them to inspect the response (human in the loop) and decide whether to allow the server to see it.
JSON schema
{
"description": "The result returned by the client for a {@link CreateMessageRequestsampling/createMessage} request.\nThe client should inform the user before returning the sampled message, to allow them\nto inspect the response (human in the loop) and decide whether to allow the server to see it.",
"type": "object",
"required": [
"content",
"model",
"role"
],
"properties": {
"_meta": {
"$ref": "#/$defs/MetaObject"
},
"content": {
"anyOf": [
{
"$ref": "#/$defs/TextContent"
},
{
"$ref": "#/$defs/ImageContent"
},
{
"$ref": "#/$defs/AudioContent"
},
{
"$ref": "#/$defs/ToolUseContent"
},
{
"$ref": "#/$defs/ToolResultContent"
},
{
"type": "array",
"items": {
"$ref": "#/$defs/SamplingMessageContentBlock"
}
}
]
},
"model": {
"description": "The name of the model that generated the message.",
"type": "string"
},
"role": {
"$ref": "#/$defs/Role"
},
"stopReason": {
"description": "The reason why sampling stopped, if known.\n\nStandard values:\n- \"endTurn\": Natural end of the assistant's turn\n- \"stopSequence\": A stop sequence was encountered\n- \"maxTokens\": Maximum token limit was reached\n- \"toolUse\": The model wants to use one or more tools\n\nThis field is an open string to allow for provider-specific stop reasons.",
"type": "string"
}
}
}Fields§
§content: CreateMessageContent§meta: Option<MetaObject>§model: StringThe name of the model that generated the message.
role: Role§stop_reason: Option<String>The reason why sampling stopped, if known. Standard values: - “endTurn”: Natural end of the assistant’s turn - “stopSequence”: A stop sequence was encountered - “maxTokens”: Maximum token limit was reached - “toolUse”: The model wants to use one or more tools This field is an open string to allow for provider-specific stop reasons.
Trait Implementations§
Source§impl Clone for CreateMessageResult
impl Clone for CreateMessageResult
Source§fn clone(&self) -> CreateMessageResult
fn clone(&self) -> CreateMessageResult
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 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<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
Source§impl From<CreateMessageResult> for InputResponse
impl From<CreateMessageResult> for InputResponse
Source§fn from(value: CreateMessageResult) -> Self
fn from(value: CreateMessageResult) -> Self
Converts to this type from the input type.
Source§impl From<CreateMessageResult> for ResultFromClient
BEGIN AUTO GENERATED
impl From<CreateMessageResult> for ResultFromClient
BEGIN AUTO GENERATED
Source§fn from(value: CreateMessageResult) -> Self
fn from(value: CreateMessageResult) -> Self
Converts to this type from the input type.
Source§impl From<CreateMessageResult> for MessageFromClient
impl From<CreateMessageResult> for MessageFromClient
Source§fn from(value: CreateMessageResult) -> Self
fn from(value: CreateMessageResult) -> Self
Converts to this type from the input type.
Source§impl Serialize for CreateMessageResult
impl Serialize for CreateMessageResult
Auto Trait Implementations§
impl Freeze for CreateMessageResult
impl RefUnwindSafe for CreateMessageResult
impl Send for CreateMessageResult
impl Sync for CreateMessageResult
impl Unpin for CreateMessageResult
impl UnsafeUnpin for CreateMessageResult
impl UnwindSafe for CreateMessageResult
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