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 Details

  • Method Details

    • getContent

      public List<Content> getContent()
      Content blocks returned by the tool.
      Returns:
      The content list, or null if not set.
    • setContent

      Sets the content blocks.
      Parameters:
      value - The new value. Can be null to unset the property.
      Returns:
      This object (for method chaining).
    • setContent

      public CallToolResult setContent(Content... value)
      Sets the content blocks.
      Parameters:
      value - The new value. Can be null to unset the property.
      Returns:
      This object (for method chaining).
    • addContent

      public CallToolResult addContent(Content... value)
      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

      public String firstText()
      Returns the text of the first TextContent block 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 TextContent block's text found while scanning the content list in order, or null if the content list is empty or unset, or it contains no TextContent block.
    • getIsError

      public Boolean getIsError()
      When true, the tool reported an application-level error.
      Returns:
      The flag, or null if not set.
    • setIsError

      Sets the error flag.
      Parameters:
      value - The new value. Can be null to unset the property.
      Returns:
      This object (for method chaining).
    • getStructuredContent

      Structured tool output, validated against the tool's outputSchema when present.

      May be any JSON-compatible value (object, array, string, number, boolean, or null).

      Returns:
      The structured content, or null if not set.
    • setStructuredContent

      Sets the structured tool output.
      Parameters:
      value - Any JSON-compatible value. Can be null.
      Returns:
      This object (for method chaining).