pub struct CreateMessageResult {
    pub content: CreateMessageResultContent,
    pub meta: Option<Map<String, Value>>,
    pub model: String,
    pub role: Role,
    pub stop_reason: Option<String>,
}Expand description
The client’s response to a sampling/create_message request from the server. 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 client's response to a sampling/create_message request from the server. 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.",
 "type": "object",
 "required": [
   "content",
   "model",
   "role"
 ],
 "properties": {
   "_meta": {
     "description": "See [General fields: _meta](/specification/2025-06-18/basic/index#meta) for notes on _meta usage.",
     "type": "object",
     "additionalProperties": {}
   },
   "content": {
     "anyOf": [
       {
         "$ref": "#/definitions/TextContent"
       },
       {
         "$ref": "#/definitions/ImageContent"
       },
       {
         "$ref": "#/definitions/AudioContent"
       }
     ]
   },
   "model": {
     "description": "The name of the model that generated the message.",
     "type": "string"
   },
   "role": {
     "$ref": "#/definitions/Role"
   },
   "stopReason": {
     "description": "The reason why sampling stopped, if known.",
     "type": "string"
   }
 }
}Fields§
§content: CreateMessageResultContent§meta: Option<Map<String, Value>>See General fields: _meta for notes on _meta usage.
model: StringThe name of the model that generated the message.
role: Role§stop_reason: Option<String>The reason why sampling stopped, if known.
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 · 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 ClientResult
 
impl From<CreateMessageResult> for ClientResult
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 From<CreateMessageResult> for ResultFromClient
 
impl From<CreateMessageResult> for ResultFromClient
Source§fn from(value: CreateMessageResult) -> Self
 
fn from(value: CreateMessageResult) -> Self
Converts to this type from the input type.
Source§impl FromMessage<CreateMessageResult> for ClientMessage
 
impl FromMessage<CreateMessageResult> for ClientMessage
fn from_message( message: CreateMessageResult, request_id: Option<RequestId>, ) -> Result<Self, RpcError>
Source§impl Serialize for CreateMessageResult
 
impl Serialize for CreateMessageResult
Source§impl ToMessage<ClientMessage> for CreateMessageResult
 
impl ToMessage<ClientMessage> for CreateMessageResult
fn to_message( self, request_id: Option<RequestId>, ) -> Result<ClientMessage, RpcError>
Auto Trait Implementations§
impl Freeze for CreateMessageResult
impl RefUnwindSafe for CreateMessageResult
impl Send for CreateMessageResult
impl Sync for CreateMessageResult
impl Unpin 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