pub enum Content {
Text {
text: String,
},
Image {
data: String,
mime_type: String,
},
Audio {
data: String,
mime_type: String,
},
Resource {
resource: ResourceContent,
},
}Expand description
Content types in MCP messages.
Variants§
Text
Text content.
Image
Image content.
Audio
Audio content.
Resource
Resource content.
Fields
§
resource: ResourceContentThe resource being referenced.
Implementations§
Source§impl Content
impl Content
Sourcepub fn image_base64(
data: impl Into<String>,
mime_type: impl Into<String>,
) -> Content
pub fn image_base64( data: impl Into<String>, mime_type: impl Into<String>, ) -> Content
Creates image content from base64-encoded data.
Sourcepub fn image_bytes(
bytes: impl AsRef<[u8]>,
mime_type: impl Into<String>,
) -> Content
pub fn image_bytes( bytes: impl AsRef<[u8]>, mime_type: impl Into<String>, ) -> Content
Creates image content from raw bytes (base64-encodes internally).
Sourcepub fn audio_base64(
data: impl Into<String>,
mime_type: impl Into<String>,
) -> Content
pub fn audio_base64( data: impl Into<String>, mime_type: impl Into<String>, ) -> Content
Creates audio content from base64-encoded data.
Sourcepub fn audio_bytes(
bytes: impl AsRef<[u8]>,
mime_type: impl Into<String>,
) -> Content
pub fn audio_bytes( bytes: impl AsRef<[u8]>, mime_type: impl Into<String>, ) -> Content
Creates audio content from raw bytes (base64-encodes internally).
Sourcepub fn resource_text(
uri: impl Into<String>,
mime_type: Option<String>,
text: impl Into<String>,
) -> Content
pub fn resource_text( uri: impl Into<String>, mime_type: Option<String>, text: impl Into<String>, ) -> Content
Creates an embedded resource content with text payload.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Content
impl<'de> Deserialize<'de> for Content
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Content, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Content, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for Content
impl Serialize for Content
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for Content
impl RefUnwindSafe for Content
impl Send for Content
impl Sync for Content
impl Unpin for Content
impl UnwindSafe for Content
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, _span: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Instruments this future with a span (no-op when disabled).
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
Instruments this future with the current span (no-op when disabled).