Package dev.tachyonmcp.api.server.domain
Interface ImageContent
- All Superinterfaces:
ContentBlock,HasMeta
An image provided to or from an LLM.
The image data is base64-encoded in data, with the corresponding
mimeType describing the format (e.g. image/png, image/jpeg).
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface dev.tachyonmcp.api.server.domain.ContentBlock
ContentBlock.Type -
Method Summary
Modifier and TypeMethodDescription@Nullable AnnotationsReturns the annotations for this content, ornullif none.static ImageContentCreates an image content block from base64-encoded data, with no metadata or annotations.static ImageContentbase64(String data, String mimeType, @Nullable Annotations annotations) Creates an image content block from base64-encoded data with given annotations and no metadata.static ImageContentbase64(String data, String mimeType, @Nullable Annotations annotations, @Nullable Map<String, Object> meta) Creates an image content block from base64-encoded data with metadata and optional annotations.static ImageContent.Builderbuilder()Creates a new builder for constructingImageContentinstances.default voidcheck()Validates that required fields are not blank.data()Returns the base64-encoded image data.meta()Returns the request-level metadata for this content, ornullif none.mimeType()Returns the MIME type of the image content.static ImageContentDeprecated, for removal: This API element is subject to removal in a future version.static ImageContentof(String data, String mimeType, @Nullable Annotations annotations) Deprecated, for removal: This API element is subject to removal in a future version.static ImageContentof(String data, String mimeType, @Nullable Annotations annotations, @Nullable Map<String, Object> meta) Deprecated, for removal: This API element is subject to removal in a future version.default ContentBlock.Typetype()Returns the MCP protocol type discriminator for this content block variant.
-
Method Details
-
data
Returns the base64-encoded image data.- Returns:
- the image data as a base64 string
-
mimeType
String mimeType()Returns the MIME type of the image content.- Returns:
- the image MIME type
-
annotations
@Nullable Annotations annotations()Returns the annotations for this content, ornullif none.- Returns:
- the annotations, or
null
-
meta
Returns the request-level metadata for this content, ornullif none. -
type
Description copied from interface:ContentBlockReturns the MCP protocol type discriminator for this content block variant.- Specified by:
typein interfaceContentBlock- Returns:
- the content type discriminator
-
check
@Check default void check()Validates that required fields are not blank.- Throws:
IllegalArgumentException- ifdataormimeTypeis blank
-
builder
Creates a new builder for constructingImageContentinstances.- Returns:
- a new builder
-
base64
Creates an image content block from base64-encoded data, with no metadata or annotations.- Parameters:
data- the base64-encoded image datamimeType- the image MIME type (e.g.image/png)
-
of
@Deprecated(since="1.0.0-beta.15", forRemoval=true) static ImageContent of(String data, String mimeType) Deprecated, for removal: This API element is subject to removal in a future version.Creates an image content block from base64-encoded data.- Parameters:
data- the base64-encoded image datamimeType- the image MIME type- Returns:
- a new image content block
-
base64
Creates an image content block from base64-encoded data with given annotations and no metadata. -
of
@Deprecated(since="1.0.0-beta.15", forRemoval=true) static ImageContent of(String data, String mimeType, @Nullable Annotations annotations) Deprecated, for removal: This API element is subject to removal in a future version.Creates an image content block from base64-encoded data with annotations.- Parameters:
data- the base64-encoded image datamimeType- the image MIME typeannotations- the annotations, ornull- Returns:
- a new image content block
-
base64
static ImageContent base64(String data, String mimeType, @Nullable Annotations annotations, @Nullable Map<String, Object> meta) Creates an image content block from base64-encoded data with metadata and optional annotations. -
of
@Deprecated(since="1.0.0-beta.15", forRemoval=true) static ImageContent of(String data, String mimeType, @Nullable Annotations annotations, @Nullable Map<String, Object> meta) Deprecated, for removal: This API element is subject to removal in a future version.Creates an image content block from base64-encoded data with annotations and metadata.- Parameters:
data- the base64-encoded image datamimeType- the image MIME typeannotations- the annotations, ornullmeta- the metadata, ornull- Returns:
- a new image content block
-
base64(String, String)