#[non_exhaustive]pub enum Content {
Text(String),
Image {
source: ImageSource,
},
Document {
source: DocumentSource,
},
ToolUse {
id: String,
name: String,
input: Value,
signature: Option<String>,
},
ToolResult {
tool_use_id: String,
content: Vec<Content>,
is_error: bool,
},
Thinking {
text: String,
signature: Option<String>,
id: Option<String>,
encrypted_content: Option<String>,
},
RedactedThinking {
data: String,
},
ServerToolUse {
id: String,
name: String,
input: Value,
},
ServerToolResult {
kind: String,
tool_use_id: String,
content: Value,
},
}Expand description
A piece of content. Text is expressible as a bare string or a {"type":"text",…}
object; other variants are tagged objects. Thinking/RedactedThinking payloads and
the two server-tool variants (CR-4) round-trip verbatim — provider-executed blocks
carried untouched, mirroring the RedactedThinking rule.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Text(String)
Image
Fields
source: ImageSourceDocument
A document/PDF, INPUT-ONLY, mirroring Image (no provider RETURNS one — no decode).
Fields
source: DocumentSourceToolUse
Fields
ToolResult
Thinking
Fields
RedactedThinking
ServerToolUse
Anthropic server-tool invocation (web_search etc.), opaque (CR-4). Echoed
back VERBATIM on replay; never folded into ToolUse. id uses srvtoolu_.
ServerToolResult
Server-tool RESULT, opaque. kind IS the wire tag (web_search_tool_result,
code_execution_tool_result, …) — an open set carried as data, re-emitted
verbatim on encode. content is the untouched provider payload: array of
results on success, or {type:*_error,...} object on failure. Echoed back
VERBATIM; NEVER a client tool_result.