ReceivedToolResult
data class ReceivedToolResult(val id: String?, val tool: String, val toolArgs: JSONObject, val toolDescription: String?, val output: String, val resultKind: ToolResultKind, val result: JSONElement?, val resultObject: Any? = null, val parts: List<MessagePart.ContentPart>? = null)(source)
Represents the result or response received from a tool operation.
Constructors
Link copied to clipboard
constructor(id: String?, tool: String, toolArgs: JSONObject, toolDescription: String?, output: String, resultKind: ToolResultKind, result: JSONElement?, resultObject: Any? = null, parts: List<MessagePart.ContentPart>? = null)
Properties
Link copied to clipboard
The content parts of the tool result. When non-null, these are forwarded to the LLM client and may include non-text content such as images. When null, output is used as plain text.
Link copied to clipboard
The kind of result produced by the tool, indicating success, failure, or validation error.
Link copied to clipboard
The raw result object produced by the tool. This value will not survive serialization, hence it should be used with caution and is marked as @InternalAgentsApi.
Link copied to clipboard
An optional description of the tool's functionality.
Functions
Link copied to clipboard
Converts the current ReceivedToolResult instance into a MessagePart.Tool.Result object.
Link copied to clipboard
fun <TResult> ReceivedToolResult.toSafeResult(tool: ToolBase<*, TResult>, serializer: JSONSerializer): SafeTool.Result<TResult>
Converts a ReceivedToolResult instance into a SafeTool.Result for safer result handling.