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>) -> Self
pub fn text_content(text: String, annotations: Option<Annotations>) -> Self
Create a CallToolResultContentItem::TextContent
Sourcepub fn image_content(
data: String,
mime_type: String,
annotations: Option<Annotations>,
) -> Self
pub fn image_content( data: String, mime_type: String, annotations: Option<Annotations>, ) -> Self
Create a CallToolResultContentItem::ImageContent
Sourcepub fn audio_content(
data: String,
mime_type: String,
annotations: Option<Annotations>,
) -> Self
pub fn audio_content( data: String, mime_type: String, annotations: Option<Annotations>, ) -> Self
Create a CallToolResultContentItem::AudioContent
Sourcepub fn embedded_resource(
resource: EmbeddedResourceResource,
annotations: Option<Annotations>,
) -> Self
pub fn embedded_resource( resource: EmbeddedResourceResource, annotations: Option<Annotations>, ) -> Self
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 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 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<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<AudioContent> for CallToolResultContentItem
impl From<AudioContent> for CallToolResultContentItem
Source§fn from(value: AudioContent) -> Self
fn from(value: AudioContent) -> Self
Converts to this type from the input type.
Source§impl From<EmbeddedResource> for CallToolResultContentItem
impl From<EmbeddedResource> for CallToolResultContentItem
Source§fn from(value: EmbeddedResource) -> Self
fn from(value: EmbeddedResource) -> Self
Converts to this type from the input type.
Source§impl From<ImageContent> for CallToolResultContentItem
impl From<ImageContent> for CallToolResultContentItem
Source§fn from(value: ImageContent) -> Self
fn from(value: ImageContent) -> Self
Converts to this type from the input type.
Source§impl From<TextContent> for CallToolResultContentItem
impl From<TextContent> for CallToolResultContentItem
Source§fn from(value: TextContent) -> Self
fn from(value: TextContent) -> Self
Converts to this type from the input type.
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