#[non_exhaustive]pub struct PromptMessage {
pub role: PromptMessageRole,
pub content: PromptMessageContent,
}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. A message in a prompt conversation
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.role: PromptMessageRoleThe role of the message sender
content: PromptMessageContentThe content of the message
Implementations§
Source§impl PromptMessage
impl PromptMessage
Sourcepub fn new(
role: PromptMessageRole,
content: PromptMessageContent,
) -> PromptMessage
pub fn new( role: PromptMessageRole, content: PromptMessageContent, ) -> PromptMessage
Create a new prompt message with the given role and content
Sourcepub fn new_text<S>(role: PromptMessageRole, text: S) -> PromptMessage
pub fn new_text<S>(role: PromptMessageRole, text: S) -> PromptMessage
Create a new text message with the given role and text content
Sourcepub fn new_resource(
role: PromptMessageRole,
uri: String,
mime_type: Option<String>,
text: Option<String>,
resource_meta: Option<Meta>,
resource_content_meta: Option<Meta>,
annotations: Option<Annotations>,
) -> PromptMessage
pub fn new_resource( role: PromptMessageRole, uri: String, mime_type: Option<String>, text: Option<String>, resource_meta: Option<Meta>, resource_content_meta: Option<Meta>, annotations: Option<Annotations>, ) -> PromptMessage
Create a new resource message. resource_meta, resource_content_meta, and annotations are optional.
Sourcepub fn new_text_with_meta<S>(
role: PromptMessageRole,
text: S,
_meta: Option<Meta>,
) -> PromptMessage
pub fn new_text_with_meta<S>( role: PromptMessageRole, text: S, _meta: Option<Meta>, ) -> PromptMessage
Note: PromptMessage text content does not carry protocol-level _meta per current schema. This function exists for API symmetry but ignores the meta parameter.
Sourcepub fn new_resource_link(
role: PromptMessageRole,
resource: Annotated<RawResource>,
) -> PromptMessage
pub fn new_resource_link( role: PromptMessageRole, resource: Annotated<RawResource>, ) -> PromptMessage
Create a new resource link message
Trait Implementations§
Source§impl Clone for PromptMessage
impl Clone for PromptMessage
Source§fn clone(&self) -> PromptMessage
fn clone(&self) -> PromptMessage
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 PromptMessage
impl Debug for PromptMessage
Source§impl<'de> Deserialize<'de> for PromptMessage
impl<'de> Deserialize<'de> for PromptMessage
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<PromptMessage, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<PromptMessage, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for PromptMessage
impl PartialEq for PromptMessage
Source§fn eq(&self, other: &PromptMessage) -> bool
fn eq(&self, other: &PromptMessage) -> bool
self and other values to be equal, and is used by ==.