#[non_exhaustive]pub enum SamplingMessageContentBlock {
Text(TextContent),
Image(ImageContent),
Audio(AudioContent),
ToolUse(ToolUseContent),
ToolResult(ToolResultContent),
}Sampling is deprecated by SEP-2577 and will be removed in a future release. See https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2577
Expand description
Content types for sampling messages (SEP-1577).
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Text(TextContent)
Sampling is deprecated by SEP-2577 and will be removed in a future release. See https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2577
Image(ImageContent)
Sampling is deprecated by SEP-2577 and will be removed in a future release. See https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2577
Audio(AudioContent)
Sampling is deprecated by SEP-2577 and will be removed in a future release. See https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2577
ToolUse(ToolUseContent)
Sampling is deprecated by SEP-2577 and will be removed in a future release. See https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2577
Assistant only
ToolResult(ToolResultContent)
Sampling is deprecated by SEP-2577 and will be removed in a future release. See https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2577
User only
Implementations§
Source§impl SamplingMessageContentBlock
impl SamplingMessageContentBlock
Sourcepub fn as_text(&self) -> Option<&TextContent>
pub fn as_text(&self) -> Option<&TextContent>
Get the text content if this is a Text variant
Sourcepub fn as_tool_use(&self) -> Option<&ToolUseContent>
pub fn as_tool_use(&self) -> Option<&ToolUseContent>
Get the tool use content if this is a ToolUse variant
Sourcepub fn as_tool_result(&self) -> Option<&ToolResultContent>
pub fn as_tool_result(&self) -> Option<&ToolResultContent>
Get the tool result content if this is a ToolResult variant
Source§impl SamplingMessageContentBlock
impl SamplingMessageContentBlock
Sourcepub fn text(text: impl Into<String>) -> SamplingMessageContentBlock
pub fn text(text: impl Into<String>) -> SamplingMessageContentBlock
Create a text content
pub fn tool_use( id: impl Into<String>, name: impl Into<String>, input: Map<String, Value>, ) -> SamplingMessageContentBlock
pub fn tool_result( tool_use_id: impl Into<String>, content: Vec<ContentBlock>, ) -> SamplingMessageContentBlock
Trait Implementations§
Source§impl Clone for SamplingMessageContentBlock
impl Clone for SamplingMessageContentBlock
Source§fn clone(&self) -> SamplingMessageContentBlock
fn clone(&self) -> SamplingMessageContentBlock
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 SamplingMessageContentBlock
impl Debug for SamplingMessageContentBlock
Source§impl<'de> Deserialize<'de> for SamplingMessageContentBlock
impl<'de> Deserialize<'de> for SamplingMessageContentBlock
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<SamplingMessageContentBlock, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<SamplingMessageContentBlock, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl From<&str> for SamplingMessageContentBlock
impl From<&str> for SamplingMessageContentBlock
Source§fn from(text: &str) -> SamplingMessageContentBlock
fn from(text: &str) -> SamplingMessageContentBlock
Source§impl From<String> for SamplingMessageContentBlock
impl From<String> for SamplingMessageContentBlock
Source§fn from(text: String) -> SamplingMessageContentBlock
fn from(text: String) -> SamplingMessageContentBlock
Source§impl From<TextContent> for SamplingMessageContentBlock
impl From<TextContent> for SamplingMessageContentBlock
Source§fn from(text: TextContent) -> SamplingMessageContentBlock
fn from(text: TextContent) -> SamplingMessageContentBlock
Source§impl JsonSchema for SamplingMessageContentBlock
impl JsonSchema for SamplingMessageContentBlock
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl Serialize for SamplingMessageContentBlock
impl Serialize for SamplingMessageContentBlock
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,
impl StructuralPartialEq for SamplingMessageContentBlock
Source§impl TryFrom<ContentBlock> for SamplingMessageContentBlock
impl TryFrom<ContentBlock> for SamplingMessageContentBlock
Source§fn try_from(
content: ContentBlock,
) -> Result<SamplingMessageContentBlock, <SamplingMessageContentBlock as TryFrom<ContentBlock>>::Error>
fn try_from( content: ContentBlock, ) -> Result<SamplingMessageContentBlock, <SamplingMessageContentBlock as TryFrom<ContentBlock>>::Error>
Auto Trait Implementations§
impl Freeze for SamplingMessageContentBlock
impl RefUnwindSafe for SamplingMessageContentBlock
impl Send for SamplingMessageContentBlock
impl Sync for SamplingMessageContentBlock
impl Unpin for SamplingMessageContentBlock
impl UnsafeUnpin for SamplingMessageContentBlock
impl UnwindSafe for SamplingMessageContentBlock
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more