Class CallToolResult
java.lang.Object
org.apache.juneau.bean.mcp.v20260728.Result<CallToolResult>
org.apache.juneau.bean.mcp.v20260728.CallToolResult
Result payload for "tools/call".
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddContent(Collection<Content> value) Appends to the content blocks.addContent(Content... value) Appends to the content blocks.Returns the text of the firstTextContentblock anywhere in the content list.Content blocks returned by the tool.Whentrue, the tool reported an application-level error.Structured tool output, validated against the tool'soutputSchemawhen present.setContent(List<Content> value) Sets the content blocks.setContent(Content... value) Sets the content blocks.setIsError(Boolean value) Sets the error flag.setStructuredContent(Object value) Sets the structured tool output.Methods inherited from class org.apache.juneau.bean.mcp.v20260728.Result
getMeta, getResultType, setMeta, setResultType
-
Constructor Details
-
CallToolResult
public CallToolResult()
-
-
Method Details
-
getContent
Content blocks returned by the tool.- Returns:
- The content list, or
nullif not set.
-
setContent
Sets the content blocks.- Parameters:
value- The new value. Can benull to unset the property.- Returns:
- This object (for method chaining).
-
setContent
Sets the content blocks.- Parameters:
value- The new value. Can benull to unset the property.- Returns:
- This object (for method chaining).
-
addContent
Appends to the content blocks.- Parameters:
value- The values to append.- Returns:
- This object (for method chaining).
-
addContent
Appends to the content blocks.- Parameters:
value- The values to append.- Returns:
- This object (for method chaining).
-
firstText
Returns the text of the firstTextContentblock anywhere in the content list.Convenience for the common case of a tool that returns text (possibly alongside other blocks, e.g. an image with a caption): scans past any leading non-text blocks instead of only ever looking at index 0, and avoids the
((TextContent)result.getContent().get(i)).getText()cast every such caller would otherwise repeat.- Returns:
- The first
TextContentblock's text found while scanning the content list in order, ornullif the content list is empty or unset, or it contains noTextContentblock.
-
getIsError
Whentrue, the tool reported an application-level error.- Returns:
- The flag, or
nullif not set.
-
setIsError
Sets the error flag.- Parameters:
value- The new value. Can benull to unset the property.- Returns:
- This object (for method chaining).
-
getStructuredContent
Structured tool output, validated against the tool'soutputSchemawhen present.May be any JSON-compatible value (object, array, string, number, boolean, or
null).- Returns:
- The structured content, or
nullif not set.
-
setStructuredContent
Sets the structured tool output.- Parameters:
value- Any JSON-compatible value. Can benull .- Returns:
- This object (for method chaining).
-