Tool

sealed interface Tool : Message(source)

Represents messages exchanged with tools, either as calls or results.

Inheritors

Types

Link copied to clipboard
data class Call(val id: String?, val tool: String, val parts: List<ContentPart.Text>, val metaInfo: ResponseMetaInfo) : Message.Tool, Message.Response

Represents a tool call message sent as a response.

Link copied to clipboard
data class Result(val id: String?, val tool: String, val parts: List<ContentPart.Text>, val metaInfo: RequestMetaInfo) : Message.Tool, Message.Request

Represents the result of a tool call sent as a request.

Properties

Link copied to clipboard
open val content: String

The textual content of the message aggregated from all ContentPart.Text parts joined to String separated by newlines.

Link copied to clipboard
abstract val id: String?

The unique identifier of the tool call.

Link copied to clipboard

Stores metadata information for the current message instance, such as token count and timestamp.

Link copied to clipboard
abstract val parts: List<ContentPart>

The content parts of the message. By default, if the message is a single text message, it will contain a single ContentPart.Text part. If the message contains multiple parts, it will contain an ordered list of ContentPart.Text and ContentPart.Attachment instances.

Link copied to clipboard
abstract val role: Message.Role

The role associated with the message.

Link copied to clipboard
abstract val tool: String

The name of the tool used.

Functions

Link copied to clipboard

Checks weather the message consists of attachments.

Link copied to clipboard

Checks weather the message consists of only sungle text content.