Class ResourceContent

java.lang.Object
com.tnsai.mcp.model.ResourceContent

public class ResourceContent extends Object
Represents the content of an MCP Resource. Can contain either text content or binary (blob) content encoded in base64.
  • Constructor Details

    • ResourceContent

      public ResourceContent()
    • ResourceContent

      public ResourceContent(String uri, String text)
  • Method Details

    • getUri

      public String getUri()
    • setUri

      public void setUri(String uri)
    • getMimeType

      public String getMimeType()
    • setMimeType

      public void setMimeType(String mimeType)
    • getText

      public String getText()
    • setText

      public void setText(String text)
    • getBlob

      public String getBlob()
    • setBlob

      public void setBlob(String blob)
    • isText

      public boolean isText()
    • isBlob

      public boolean isBlob()
    • getDecodedBlob

      public byte[] getDecodedBlob()
      Decodes and returns the binary content if present.
      Returns:
      decoded binary data, or null if no blob content
    • setBlobFromBytes

      public void setBlobFromBytes(byte[] data)
      Sets binary content from raw bytes (encodes to base64).
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • text

      public static ResourceContent text(String uri, String content)
    • text

      public static ResourceContent text(String uri, String content, String mimeType)
    • blob

      public static ResourceContent blob(String uri, byte[] data, String mimeType)