Tool

@Target(allowedTargets = [AnnotationTarget.FUNCTION])
annotation class Tool(val name: String = "", val description: String = "", val requireConfirmation: Boolean = false, val isLongRunning: Boolean = false)

Annotates a function to be exposed as an executable tool by the Google ADK Kotlin. KSP will generate a corresponding com.google.adk.kt.tools.FunctionTool wrapper for annotated functions.

The generated wrapper converts the function's return value into a JSON-native Map: data classes, enums, lists, maps, and nested structures are translated at compile time. A function may therefore return a data class directly, unlike a hand-written com.google.adk.kt.tools.BaseTool, whose result must already be JSON-native.

Note: this annotation shares its simple name with com.google.adk.kt.types.Tool, the GenAI tool definition data class. Files that need to reference both should use an import alias.

Properties

Link copied to clipboard

An optional explicit description. If not provided, the KDoc summary is used.

Link copied to clipboard
val isLongRunning: Boolean = false

If true, indicates the tool returns a Pending state and resumes later.

Link copied to clipboard

An optional explicit name for the tool. If not provided, the function name is used.

Link copied to clipboard

If true, the tool execution requires user confirmation.