Class McpImageContent
java.lang.Object
com.soklet.McpImageContent
- All Implemented Interfaces:
McpContentBlock
Immutable binary image MCP content block.
The MIME type is validated as an ASCII type/subtype with optional parameters, using the same syntax parser as MCP Apps. Malformed syntax, controls, non-ASCII characters, and duplicate parameter names are rejected. Its spelling is retained; Soklet does not inspect the bytes or check whether a particular client supports the declared format.
The built-in server can send at most 786,432 raw bytes per binary content
item: Base64 encoding must fit the 1,048,576-character JSON string limit.
The complete response must also fit the 4 MiB UTF-8 JSON limit. Construction
defensively copies data but does not prevalidate the eventual response size.
Prefer McpResourceLink for larger payloads.
- Author:
- Mark Allen
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classMutable builder for immutableMcpImageContent. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns optional presentation annotations for this content block.byte @NonNull []getData()Returns protocol extension metadata associated with this content block.inthashCode()static @NonNull McpImageContent.BuilderwithDataAndMimeType(byte @NonNull [] data, @NonNull String mimeType) Vends a builder primed with image bytes and their MIME type.
-
Method Details
-
withDataAndMimeType
public static @NonNull McpImageContent.Builder withDataAndMimeType(byte @NonNull [] data, @NonNull String mimeType) Vends a builder primed with image bytes and their MIME type.- Parameters:
data- image bytes, defensively copiedmimeType- image MIME type- Returns:
- image-content builder
- Throws:
IllegalArgumentException- if the MIME type has malformed syntax
-
getData
-
getMimeType
- Returns:
- image MIME type
-
getAnnotations
Description copied from interface:McpContentBlockReturns optional presentation annotations for this content block.- Specified by:
getAnnotationsin interfaceMcpContentBlock- Returns:
- content annotations, if supplied
-
getMetadata
Description copied from interface:McpContentBlockReturns protocol extension metadata associated with this content block.- Specified by:
getMetadatain interfaceMcpContentBlock- Returns:
- immutable extension metadata
-
equals
-
hashCode
-