AnthropicContentBlock
AnthropicContentBlock = {
text:string;type:"text"; } | {source: {type:"url";url:string; } | {data:string;media_type:string;type:"base64"; };type:"image"; } | {id:string;input:Record<string,unknown>;name:string;type:"tool_use"; }
Defined in: frontend/dist/types/adapters/anthropic.d.ts:58
Anthropic content block type supporting text, images, and tool usage.
Claude uses a structured content block format where each piece of content
is represented as an object with a discriminated type field. This enables
multimodal messages mixing text, images, and tool interactions.
- AnthropicMessage
- https://docs.anthropic.com/en/api/messages
Example
Section titled “Example”// Text blockconst text: AnthropicContentBlock = { type: 'text', text: 'Hello, Claude!'};
// Image from URLconst imageUrl: AnthropicContentBlock = { type: 'image', source: { type: 'url', url: 'https://example.com/photo.jpg' }};
// Base64 imageconst imageB64: AnthropicContentBlock = { type: 'image', source: { type: 'base64', media_type: 'image/jpeg', data: '/9j/4AAQSkZJRg...' }};
// Tool use requestconst toolUse: AnthropicContentBlock = { type: 'tool_use', id: 'toolu_123', name: 'get_weather', input: { location: 'San Francisco' }};