ToolResult

@SerialName(value = "tool_result")
@Serializable
data class ToolResult(val toolCallId: String, val name: String, val content: String) : Content.Request

The result of executing a tool, sent back to the model.

Samples

// ToolCall and ToolResult are used as a request only if you have disabled autoExecute and are processing the tool manually.
val executeResult = executeTool(toolCall.name, toolCall.argumentsJson) // Returns String.

// Create a ToolResult.
val toolResult = Content.ToolResult(
    toolCallId = toolCall.id,
    name = toolCall.name,
    content = toolCall.argumentsJson
)

// Send toolResult to API...

Constructors

Link copied to clipboard
constructor(toolCallId: String, name: String, content: String)

Properties

Link copied to clipboard

The result content (typically a string or JSON).

Link copied to clipboard

The name of the tool that was executed.

Link copied to clipboard

The ID of the ToolCall this result responds to.

Functions

Link copied to clipboard

Wraps this request content as an assistant Message.