Class McpToolOutcome
java.lang.Object
org.apache.juneau.rest.server.mcp.McpToolOutcome
Revision-neutral result of a
tools/call invocation.
Supersedes the wire-level CallToolResult bean. structuredContent is cross-revision.
Deliberately absent: cachePolicy, which remains specific to later MCP revisions.
Note the field is named error, while the 2025-06-18 wire property is
isError; the rename happens at the adapter boundary and is intentional. Do not
"fix" this field name to match the wire.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionThe content blocks returned by the tool.getError()Whether the tool call represents an error result.The structured JSON result returned by the tool.static McpToolOutcomeof(McpContentBlock... values) Creates an outcome carrying the supplied blocks.setContent(List<McpContentBlock> value) Sets the content blocks.Sets the error flag.setStructuredContent(Object value) Sets the structured JSON result.static McpToolOutcomeCreates an outcome carrying a single text block.
-
Constructor Details
-
McpToolOutcome
public McpToolOutcome()
-
-
Method Details
-
text
Creates an outcome carrying a single text block.- Parameters:
value- The text. Can benull .- Returns:
- A new outcome. Never
null .
-
of
Creates an outcome carrying the supplied blocks.- Parameters:
values- The content blocks. Must not benull .- Returns:
- A new outcome. Never
null .
-
getContent
The content blocks returned by the tool.- Returns:
- The blocks, or
null if not set. Anull value is distinct from an empty list: it means the wire property is omitted entirely.
-
setContent
Sets the content blocks.- Parameters:
value- The new value. Can benull to unset the property.- Returns:
- This object.
-
getError
Whether the tool call represents an error result.- Returns:
- The flag, or
null if not set.
-
setError
Sets the error flag.- Parameters:
value- The new value. Can benull to unset the property.- Returns:
- This object.
-
getStructuredContent
The structured JSON result returned by the tool.- Returns:
- The JSON value, or
null if absent.
-
setStructuredContent
Sets the structured JSON result.- Parameters:
value- Any JSON-compatible value. Can benull .- Returns:
- This object.
-