Class McpContentBlock
java.lang.Object
org.apache.juneau.rest.server.mcp.McpContentBlock
Revision-neutral content block returned by tool calls and prompt messages.
Carries all three variants supported today — text, image, and embedded resource — so a handler
cannot express less through the neutral model than it can through a wire bean. Supersedes the
wire-level Content dictionary and its three leaf types.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumWhich content variant is populated. -
Method Summary
Modifier and TypeMethodDescriptiondata()The base64 image payload.static McpContentBlockCreates an image content block.kind()Which variant this block carries.mimeType()The image media type.resource()The embedded resource payload.static McpContentBlockresource(McpResourceContents resource) Creates an embedded-resource content block.text()The text payload.static McpContentBlockCreates a text content block.
-
Method Details
-
text
Creates a text content block.- Parameters:
text- The text. Can benull .- Returns:
- A new block. Never
null .
-
image
Creates an image content block.- Parameters:
data- Base64-encoded image bytes. Can benull .mimeType- The image media type. Can benull .- Returns:
- A new block. Never
null .
-
resource
Creates an embedded-resource content block.- Parameters:
resource- The embedded payload. Can benull .- Returns:
- A new block. Never
null .
-
kind
Which variant this block carries.- Returns:
- The variant. Never
null .
-
text
The text payload.- Returns:
- The text, or
null unless this is aMcpContentBlock.Kind.TEXTblock.
-
data
The base64 image payload.- Returns:
- The data, or
null unless this is aMcpContentBlock.Kind.IMAGEblock.
-
mimeType
The image media type.- Returns:
- The media type, or
null unless this is aMcpContentBlock.Kind.IMAGEblock.
-
resource
The embedded resource payload.- Returns:
- The payload, or
null unless this is aMcpContentBlock.Kind.RESOURCEblock.
-