Class McpResourceContents

java.lang.Object
org.apache.juneau.rest.server.mcp.McpResourceContents

public final class McpResourceContents extends Object
Revision-neutral resource payload, either inline text or a base64 blob.

Supersedes the wire-level ResourceContents dictionary and its two leaf types. Used both by McpContentBlock.resource(McpResourceContents) and by McpResourceOutcome.

  • Method Details

    • text

      public static McpResourceContents text(String uri, String mimeType, String text)
      Creates an inline-text resource payload.
      Parameters:
      uri - The resource URI. Can be null.
      mimeType - The media type. Can be null.
      text - The text payload. Can be null.
      Returns:
      A new payload. Never null.
    • blob

      public static McpResourceContents blob(String uri, String mimeType, String blob)
      Creates a base64-blob resource payload.
      Parameters:
      uri - The resource URI. Can be null.
      mimeType - The media type. Can be null.
      blob - The base64-encoded payload. Can be null.
      Returns:
      A new payload. Never null.
    • kind

      Which variant this payload carries.
      Returns:
      The variant. Never null.
    • uri

      public String uri()
      The resource URI.
      Returns:
      The URI, or null if not set.
    • mimeType

      public String mimeType()
      The media type.
      Returns:
      The media type, or null if not set.
    • text

      public String text()
      The inline text payload.
      Returns:
      The text, or null for a McpResourceContents.Kind.BLOB payload.
    • blob

      public String blob()
      The base64-encoded payload.
      Returns:
      The blob, or null for a McpResourceContents.Kind.TEXT payload.