Class McpBlobResourceContents
java.lang.Object
com.soklet.McpBlobResourceContents
- All Implemented Interfaces:
McpResourceContents
@ThreadSafe
public final class McpBlobResourceContents
extends Object
implements McpResourceContents
Immutable binary contents for one MCP resource.
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; an MCP resource read
returning these contents remains subject to the same limits.
- Author:
- Mark Allen
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classMutable builder for immutableMcpBlobResourceContents. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns separately configured Apps policy and presentation hints.byte @NonNull []getData()Returns a defensive copy of the resource bytes.Returns protocol extension metadata associated with this resource.Returns the resource MIME type, if one was supplied.getUri()Returns the URI that identifies this resource.inthashCode()withUriAndData(@NonNull URI uri, byte @NonNull [] data) Vends a builder primed with the resource URI and binary data.
-
Method Details
-
withUriAndData
public static @NonNull McpBlobResourceContents.Builder withUriAndData(@NonNull URI uri, byte @NonNull [] data) Vends a builder primed with the resource URI and binary data.- Parameters:
uri- absolute normalized resource URI in ASCII wire formdata- resource bytes, defensively copied- Returns:
- resource-content builder
- Throws:
IllegalArgumentException- if the URI is relative, not normalized, or not in ASCII wire form
-
getUri
Returns the URI that identifies this resource.- Specified by:
getUriin interfaceMcpResourceContents- Returns:
- absolute normalized resource URI in ASCII wire form
-
getData
-
getMimeType
Returns the resource MIME type, if one was supplied.- Specified by:
getMimeTypein interfaceMcpResourceContents- Returns:
- resource MIME type, if available
-
getAppResourceMetadata
Returns separately configured Apps policy and presentation hints.- Specified by:
getAppResourceMetadatain interfaceMcpResourceContents- Returns:
- typed Apps resource metadata, if supplied
-
getMetadata
Returns protocol extension metadata associated with this resource.- Specified by:
getMetadatain interfaceMcpResourceContents- Returns:
- immutable metadata object
-
equals
-
hashCode
-