pub enum CallToolResultContentItem {
TextContent(TextContent),
ImageContent(ImageContent),
AudioContent(AudioContent),
EmbeddedResource(EmbeddedResource),
}
Expand description
CallToolResultContentItem
JSON schema
{
"anyOf": [
{
"$ref": "#/definitions/TextContent"
},
{
"$ref": "#/definitions/ImageContent"
},
{
"$ref": "#/definitions/AudioContent"
},
{
"$ref": "#/definitions/EmbeddedResource"
}
]
}
Variants§
TextContent(TextContent)
ImageContent(ImageContent)
AudioContent(AudioContent)
EmbeddedResource(EmbeddedResource)
Implementations§
Source§impl CallToolResultContentItem
impl CallToolResultContentItem
Sourcepub fn text_content(
text: String,
annotations: Option<Annotations>,
) -> CallToolResultContentItem
pub fn text_content( text: String, annotations: Option<Annotations>, ) -> CallToolResultContentItem
Create a CallToolResultContentItem::TextContent
Sourcepub fn image_content(
data: String,
mime_type: String,
annotations: Option<Annotations>,
) -> CallToolResultContentItem
pub fn image_content( data: String, mime_type: String, annotations: Option<Annotations>, ) -> CallToolResultContentItem
Create a CallToolResultContentItem::ImageContent
Sourcepub fn audio_content(
data: String,
mime_type: String,
annotations: Option<Annotations>,
) -> CallToolResultContentItem
pub fn audio_content( data: String, mime_type: String, annotations: Option<Annotations>, ) -> CallToolResultContentItem
Create a CallToolResultContentItem::AudioContent
Sourcepub fn embedded_resource(
resource: EmbeddedResourceResource,
annotations: Option<Annotations>,
) -> CallToolResultContentItem
pub fn embedded_resource( resource: EmbeddedResourceResource, annotations: Option<Annotations>, ) -> CallToolResultContentItem
Create a CallToolResultContentItem::EmbeddedResource
Sourcepub fn content_type(&self) -> &str
pub fn content_type(&self) -> &str
Returns the content type as a string based on the variant of CallToolResultContentItem
.
Sourcepub fn as_text_content(&self) -> Result<&TextContent, RpcError>
pub fn as_text_content(&self) -> Result<&TextContent, RpcError>
Converts the content to a reference to TextContent
, returning an error if the conversion is invalid.
Sourcepub fn as_image_content(&self) -> Result<&ImageContent, RpcError>
pub fn as_image_content(&self) -> Result<&ImageContent, RpcError>
Converts the content to a reference to TextContent
, returning an error if the conversion is invalid.
Sourcepub fn as_audio_content(&self) -> Result<&AudioContent, RpcError>
pub fn as_audio_content(&self) -> Result<&AudioContent, RpcError>
Converts the content to a reference to TextContent
, returning an error if the conversion is invalid.
Sourcepub fn as_embedded_resource(&self) -> Result<&EmbeddedResource, RpcError>
pub fn as_embedded_resource(&self) -> Result<&EmbeddedResource, RpcError>
Converts the content to a reference to TextContent
, returning an error if the conversion is invalid.
Trait Implementations§
Source§impl Clone for CallToolResultContentItem
impl Clone for CallToolResultContentItem
Source§fn clone(&self) -> CallToolResultContentItem
fn clone(&self) -> CallToolResultContentItem
Returns a copy 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 CallToolResultContentItem
impl Debug for CallToolResultContentItem
Source§impl<'de> Deserialize<'de> for CallToolResultContentItem
impl<'de> Deserialize<'de> for CallToolResultContentItem
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<CallToolResultContentItem, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<CallToolResultContentItem, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<AudioContent> for CallToolResultContentItem
impl From<AudioContent> for CallToolResultContentItem
Source§fn from(value: AudioContent) -> CallToolResultContentItem
fn from(value: AudioContent) -> CallToolResultContentItem
Converts to this type from the input type.
Source§impl From<EmbeddedResource> for CallToolResultContentItem
impl From<EmbeddedResource> for CallToolResultContentItem
Source§fn from(value: EmbeddedResource) -> CallToolResultContentItem
fn from(value: EmbeddedResource) -> CallToolResultContentItem
Converts to this type from the input type.
Source§impl From<ImageContent> for CallToolResultContentItem
impl From<ImageContent> for CallToolResultContentItem
Source§fn from(value: ImageContent) -> CallToolResultContentItem
fn from(value: ImageContent) -> CallToolResultContentItem
Converts to this type from the input type.
Source§impl From<TextContent> for CallToolResultContentItem
impl From<TextContent> for CallToolResultContentItem
Source§fn from(value: TextContent) -> CallToolResultContentItem
fn from(value: TextContent) -> CallToolResultContentItem
Converts to this type from the input type.
Source§impl Serialize for CallToolResultContentItem
impl Serialize for CallToolResultContentItem
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 CallToolResultContentItem
impl RefUnwindSafe for CallToolResultContentItem
impl Send for CallToolResultContentItem
impl Sync for CallToolResultContentItem
impl Unpin for CallToolResultContentItem
impl UnwindSafe for CallToolResultContentItem
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