Record Class McpResourceContents

java.lang.Object
java.lang.Record
com.soklet.McpResourceContents

@Immutable public record McpResourceContents(@NonNull String uri, @NonNull String mimeType, @Nullable String text, @Nullable String blobBase64) extends Record
Immutable resource-read result payload.
Author:
Mark Allen
  • Constructor Details

    • McpResourceContents

      public McpResourceContents(@NonNull String uri, @NonNull String mimeType, @Nullable String text, @Nullable String blobBase64)
      Creates an instance of a McpResourceContents record class.
      Parameters:
      uri - the value for the uri record component
      mimeType - the value for the mimeType record component
      text - the value for the text record component
      blobBase64 - the value for the blobBase64 record component
  • Method Details

    • fromText

      Creates a text-backed resource-contents payload.
      Parameters:
      uri - the resource URI
      text - the text payload
      mimeType - the MIME type
      Returns:
      a text-backed resource contents value
    • fromBlob

      public static @NonNull McpResourceContents fromBlob(@NonNull String uri, @NonNull String blobBase64, @NonNull String mimeType)
      Creates a blob-backed resource-contents payload.
      Parameters:
      uri - the resource URI
      blobBase64 - the base64-encoded blob payload
      mimeType - the MIME type
      Returns:
      a blob-backed resource contents value
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • uri

      public @NonNull String uri()
      Returns the value of the uri record component.
      Returns:
      the value of the uri record component
    • mimeType

      Returns the value of the mimeType record component.
      Returns:
      the value of the mimeType record component
    • text

      public @Nullable String text()
      Returns the value of the text record component.
      Returns:
      the value of the text record component
    • blobBase64

      Returns the value of the blobBase64 record component.
      Returns:
      the value of the blobBase64 record component