pub enum ContentBlock {
Text {
text: String,
cache_control: Option<CacheControl>,
},
ImageUrl {
image_url: ImageUrlContent,
},
Thinking {
thinking: String,
signature: Option<String>,
state: Option<OpaqueReasoningState>,
redacted_data: Option<String>,
},
ToolUse {
id: String,
name: String,
input: Value,
execution_id: Option<String>,
caller: Option<ToolCaller>,
thought_signature: Option<String>,
},
ToolResult {
tool_use_id: String,
content: String,
execution_id: Option<String>,
is_error: Option<bool>,
content_blocks: Option<Vec<Value>>,
},
ServerToolUse {
id: String,
name: String,
input: Value,
},
ToolSearchToolResult {
tool_use_id: String,
content: Value,
},
CodeExecutionToolResult {
tool_use_id: String,
content: Value,
},
}Expand description
A single content block inside a message.
Variants§
Text
ImageUrl
Fields
image_url: ImageUrlContentThinking
Fields
signature: Option<String>Anthropic signed-thinking signature (#3014). Only populated on the native Messages dialect and serde-skipped when absent so OpenAI dialects are unaffected. Anthropic rejects tool loops that drop or modify signed thinking blocks, so replay this verbatim.
state: Option<OpaqueReasoningState>Opaque Responses-style continuity. Never synthesize this from the
readable thinking text or carry it across a route/model switch.
redacted_data: Option<String>Anthropic redacted_thinking payload (data): the encrypted
replacement for a whole thinking block that the provider withheld
for safety reasons. It must be replayed byte-exact — the API
decrypts it to restore the turn’s reasoning — and is mutually
exclusive with readable thinking text and with signature.
Stored on the same variant (instead of a sibling one) so existing
sessions and matches keep compiling; the serde field is absent
for every non-redacted block.
ToolUse
Fields
execution_id: Option<String>Host-owned execution correlation, distinct from the provider’s id. Persisted with history; provider adapters project only wire fields. Missing identifies legacy/provider-only history, never a new grant.
caller: Option<ToolCaller>ToolResult
Fields
ServerToolUse
ToolSearchToolResult
CodeExecutionToolResult
Implementations§
Source§impl ContentBlock
impl ContentBlock
Sourcepub fn tool_call_key(&self) -> Option<ToolCallKey<'_>>
pub fn tool_call_key(&self) -> Option<ToolCallKey<'_>>
Pairing identity in persisted host history. An explicit execution id never falls back to provider correlation, even if malformed or mismatched. Wire adapters must continue using the original id/tool_use_id instead.