Skip to content

Content ​

Category: Acp

Source: content.dart

ACP content block types — the polymorphic shape that carries text, images, audio, file references, and (for tool results) diffs or terminal handles.

Used by:

  • agent_message_chunk.content — assistant text/thinking
  • tool_call_update.content[] — tool execution output
  • session/prompt.prompt[] — client→agent input blocks

See https://agentclientprotocol.com/ § ContentBlock.

Classes ​

sealed AcpContentBlock ​

A single content block — sealed for exhaustive switch handling.

Constructor ​

dart
const AcpContentBlock()
dart
factory AcpContentBlock.fromJson(Map<String, Object?> json)

Parse an inbound content block from the wire shape. Returns [AcpUnknownBlock] for shapes we don't yet recognise so unknown types round-trip without losing data.

Properties ​

PropertyTypeDescription
textString
mimeTypeStringe.g. image/png, image/jpeg.
dataStringBase64-encoded image bytes.
uriString?Optional source URL (e.g. the screenshot's page URL).

Methods ​

static AcpContentBlock fromContentPart(ContentPart part) ​

Convert a glue_core [ContentPart] to an ACP block.

const AcpTextBlock(this.text) ​
const AcpImageBlock({required this.mimeType, required this.data, this.uri}) ​
List&lt;int&gt; decodedBytes() ​

Decoded image bytes. May be expensive; use sparingly.

AcpTextBlock ​

Constructor ​

dart
const AcpTextBlock(this.text)

Properties ​

PropertyTypeDescription
textString

AcpImageBlock ​

Constructor ​

dart
const AcpImageBlock({required this.mimeType, required this.data, this.uri})

Properties ​

PropertyTypeDescription
mimeTypeStringe.g. image/png, image/jpeg.
dataStringBase64-encoded image bytes.
uriString?Optional source URL (e.g. the screenshot's page URL).
mimeTypeString
dataString
uriString
nameString?
descriptionString?
mimeTypeString?
rawMap&lt;String, Object?&gt;
blockAcpContentBlock
pathString
oldTextString
newTextString
terminalIdString

Methods ​

List&lt;int&gt; decodedBytes() ​

Decoded image bytes. May be expensive; use sparingly.

const AcpAudioBlock({required this.mimeType, required this.data}) ​
`const AcpResourceLinkBlock({ ​
required this.uri,
this.name,
this.description,
this.mimeType,

})`

const AcpUnknownBlock(this.raw) ​
const AcpToolCallContent() ​
const AcpToolCallContentValue(this.block) ​
`const AcpToolCallDiff({ ​
required this.path,
required this.oldText,
required this.newText,

})`

const AcpToolCallTerminal(this.terminalId) ​

AcpAudioBlock ​

Constructor ​

dart
const AcpAudioBlock({required this.mimeType, required this.data})

Properties ​

PropertyTypeDescription
mimeTypeString
dataString

AcpResourceLinkBlock ​

Constructor ​

dart
const AcpResourceLinkBlock({
    required this.uri,
    this.name,
    this.description,
    this.mimeType,
  })

Properties ​

PropertyTypeDescription
uriString
nameString?
descriptionString?
mimeTypeString?

AcpUnknownBlock ​

Fallback for blocks we don't know about. Preserves the original wire shape so it can be passed through verbatim.

Constructor ​

dart
const AcpUnknownBlock(this.raw)

Properties ​

PropertyTypeDescription
rawMap&lt;String, Object?&gt;

sealed AcpToolCallContent ​

Constructor ​

dart
const AcpToolCallContent()

AcpToolCallContentValue ​

{type: 'content', content: ContentBlock} — the common case for text/image tool output.

Constructor ​

dart
const AcpToolCallContentValue(this.block)

Properties ​

PropertyTypeDescription
blockAcpContentBlock

AcpToolCallDiff ​

{type: 'diff', path, oldText, newText} — for write_file / edit_file.

Constructor ​

dart
const AcpToolCallDiff({
    required this.path,
    required this.oldText,
    required this.newText,
  })

Properties ​

PropertyTypeDescription
pathString
oldTextString
newTextString

AcpToolCallTerminal ​

{type: 'terminal', terminalId} — references a live terminal handle the client opened via the terminal/* capability set.

Constructor ​

dart
const AcpToolCallTerminal(this.terminalId)

Properties ​

PropertyTypeDescription
terminalIdString

Released under the MIT License.