ContentBlock class

Base class for all MCP content blocks (text, image, audio, resource, etc.).

Inheritance

Constructors

ContentBlock({required String type, required String data, required String mimeType, Annotations? annotations, MetaObject? $meta})
Creates a ContentBlock.
ContentBlock.toMCP(Map<String, Object?> map)
Builds a ContentBlock from a decoded MCP JSON map.
factory

Properties

$meta ↔ MetaObject?
Optional metadata.
getter/setter pair
annotations ↔ Annotations?
Optional client annotations.
getter/setter pair
data ↔ String
Base64-encoded binary data (used for image / audio content).
getter/setter pair
hashCode → int
The hash code for this object.
no setterinherited
mimeType ↔ String
MIME type of data.
getter/setter pair
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
type ↔ String
The content type discriminator (e.g. "text", "image", "audio").
getter/setter pair

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toMap() → Map<String, Object?>
Converts this ContentBlock into a JSON-compatible map.
override
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited