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.
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
pub fn text(text: impl Into<String>) -> SamplingMessageContentBlock
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 more