Class McpTextResourceContents
java.lang.Object
com.soklet.McpTextResourceContents
- All Implemented Interfaces:
McpResourceContents
@ThreadSafe
public final class McpTextResourceContents
extends Object
implements McpResourceContents
Immutable UTF-16 Java text contents for one MCP resource.
Construction rejects unpaired UTF-16 surrogates with
IllegalArgumentException. Well-formed text is retained exactly,
without normalization or replacement. Text must fit the independent JSON
string/token and complete-response limits described by McpJsonString;
construction does not prevalidate its eventual serialized size.
- Author:
- Mark Allen
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classMutable builder for immutableMcpTextResourceContents. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns separately configured Apps policy and presentation hints.Returns protocol extension metadata associated with this resource.Returns the resource MIME type, if one was supplied.getText()getUri()Returns the URI that identifies this resource.inthashCode()withUriAndText(@NonNull URI uri, @NonNull String text) Vends a builder primed with the resource URI and text.
-
Method Details
-
withUriAndText
public static @NonNull McpTextResourceContents.Builder withUriAndText(@NonNull URI uri, @NonNull String text) Vends a builder primed with the resource URI and text.- Parameters:
uri- absolute normalized resource URI in ASCII wire formtext- resource text- Returns:
- resource-content builder
- Throws:
IllegalArgumentException- if the URI is relative, not normalized, or not in ASCII wire form, or the text contains an unpaired surrogate
-
getUri
Returns the URI that identifies this resource.- Specified by:
getUriin interfaceMcpResourceContents- Returns:
- absolute normalized resource URI in ASCII wire form
-
getText
-
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
-