Success

data class Success<TResult : ToolResult>(val result: TResult, val content: String) : SafeTool.Result<TResult> (source)

Represents a successful result of an operation, wrapping a specific tool result and its corresponding content.

The Success class is a concrete implementation of the Result sealed interface, specifically used to indicate successful outcomes. It stores both the result of type TResult and its associated content as a string.

Parameters

TResult

The type of the tool result, which must implement the ToolResult interface.

Constructors

Link copied to clipboard
constructor(result: TResult, content: String)

Properties

Link copied to clipboard
open override val content: String

The associated content describing or representing the result in string format.

Link copied to clipboard

The tool result encapsulated within this success instance.

Functions

Link copied to clipboard

Casts the current object to a Failure type.

Link copied to clipboard

Casts the current instance of Result to a Success type if it is a successful result.

Link copied to clipboard
open fun isFailure(): Boolean

Determines whether the current instance represents a failure state.

Link copied to clipboard
open fun isSuccessful(): Boolean

Determines if the current result represents a successful operation.