pub enum SamplingMessageContentBlock {
Text {
text: String,
annotations: Option<Annotations>,
meta: Option<HashMap<String, Value>>,
},
Image {
data: String,
mime_type: String,
annotations: Option<Annotations>,
meta: Option<HashMap<String, Value>>,
},
Audio {
data: String,
mime_type: String,
annotations: Option<Annotations>,
meta: Option<HashMap<String, Value>>,
},
ToolUse {
id: String,
name: String,
input: HashMap<String, Value>,
meta: Option<HashMap<String, Value>>,
},
ToolResult {
tool_use_id: String,
content: Vec<ContentBlock>,
structured_content: Option<Value>,
is_error: Option<bool>,
meta: Option<HashMap<String, Value>>,
},
}Deprecated per SEP-2577 (2026-07-28). Replacement: integrate directly with LLM provider APIs. Earliest removal: first release on/after 2027-07-28.
protocol-2026-07-28 only.Expand description
Content block variant allowed inside a SamplingMessage.
Strict 5-element union — excludes the ResourceLink and EmbeddedResource
variants that the general ContentBlock allows. Discriminated on the
type field exactly like ContentBlock for wire-format symmetry across
the 5 shared shapes.
Deprecated per SEP-2577 — see module-level docs.
Variants§
Text
Deprecated per SEP-2577 (2026-07-28). Replacement: integrate directly with LLM provider APIs. Earliest removal: first release on/after 2027-07-28.
Text provided to or from an LLM.
Fields
text: StringDeprecated per SEP-2577 (2026-07-28). Replacement: integrate directly with LLM provider APIs. Earliest removal: first release on/after 2027-07-28.
The text content of the message.
annotations: Option<Annotations>Deprecated per SEP-2577 (2026-07-28). Replacement: integrate directly with LLM provider APIs. Earliest removal: first release on/after 2027-07-28.
Optional annotations for the client.
Image
Deprecated per SEP-2577 (2026-07-28). Replacement: integrate directly with LLM provider APIs. Earliest removal: first release on/after 2027-07-28.
An image provided to or from an LLM.
Fields
data: StringDeprecated per SEP-2577 (2026-07-28). Replacement: integrate directly with LLM provider APIs. Earliest removal: first release on/after 2027-07-28.
The base64-encoded image data.
mime_type: StringDeprecated per SEP-2577 (2026-07-28). Replacement: integrate directly with LLM provider APIs. Earliest removal: first release on/after 2027-07-28.
The MIME type of the image, for example image/png.
annotations: Option<Annotations>Deprecated per SEP-2577 (2026-07-28). Replacement: integrate directly with LLM provider APIs. Earliest removal: first release on/after 2027-07-28.
Optional annotations for the client.
Audio
Deprecated per SEP-2577 (2026-07-28). Replacement: integrate directly with LLM provider APIs. Earliest removal: first release on/after 2027-07-28.
Audio provided to or from an LLM.
Fields
data: StringDeprecated per SEP-2577 (2026-07-28). Replacement: integrate directly with LLM provider APIs. Earliest removal: first release on/after 2027-07-28.
The base64-encoded audio data.
mime_type: StringDeprecated per SEP-2577 (2026-07-28). Replacement: integrate directly with LLM provider APIs. Earliest removal: first release on/after 2027-07-28.
The MIME type of the audio, for example audio/wav.
annotations: Option<Annotations>Deprecated per SEP-2577 (2026-07-28). Replacement: integrate directly with LLM provider APIs. Earliest removal: first release on/after 2027-07-28.
Optional annotations for the client.
ToolUse
Deprecated per SEP-2577 (2026-07-28). Replacement: integrate directly with LLM provider APIs. Earliest removal: first release on/after 2027-07-28.
A request from the assistant to call a tool.
Fields
id: StringDeprecated per SEP-2577 (2026-07-28). Replacement: integrate directly with LLM provider APIs. Earliest removal: first release on/after 2027-07-28.
A unique identifier for this tool use, which the corresponding tool result echoes as toolUseId.
name: StringDeprecated per SEP-2577 (2026-07-28). Replacement: integrate directly with LLM provider APIs. Earliest removal: first release on/after 2027-07-28.
The name of the tool to call.
ToolResult
Deprecated per SEP-2577 (2026-07-28). Replacement: integrate directly with LLM provider APIs. Earliest removal: first release on/after 2027-07-28.
The result of a tool use, provided by the user back to the assistant.
Fields
tool_use_id: StringDeprecated per SEP-2577 (2026-07-28). Replacement: integrate directly with LLM provider APIs. Earliest removal: first release on/after 2027-07-28.
The id of the tool use this result corresponds to; it must match a previous tool use.
content: Vec<ContentBlock>Deprecated per SEP-2577 (2026-07-28). Replacement: integrate directly with LLM provider APIs. Earliest removal: first release on/after 2027-07-28.
The unstructured result of the tool use, in the same format as a tools/call result’s content.
structured_content: Option<Value>Deprecated per SEP-2577 (2026-07-28). Replacement: integrate directly with LLM provider APIs. Earliest removal: first release on/after 2027-07-28.
The structured result of the tool use, as any JSON value; it should conform to the tool’s output schema when one is defined.
Implementations§
Source§impl SamplingMessageContentBlock
impl SamplingMessageContentBlock
Sourcepub fn text(text: impl Into<String>) -> SamplingMessageContentBlock
Available on crate feature http only.
pub fn text(text: impl Into<String>) -> SamplingMessageContentBlock
http only.Constructs a text block.
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 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,
Auto Trait Implementations§
impl Forget for SamplingMessageContentBlock
impl Freeze for SamplingMessageContentBlock
impl Move 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