-
-
Method Summary
Modifier and Type Method Description abstract VoiceToolResultprecondition()Precondition check that runs before execute. abstract StringgetName()Unique identifier for the tool (e.g., "get_load_status"). abstract StringgetDescription()Human-readable description of what the tool does. abstract KClass<T>getParamsClass()The KClass of the parameters data class. abstract StringgetSchema()JSON schema auto-generated from paramsClass. abstract SuspendFunction1<T, VoiceToolResult>getExecute()Suspending function that executes the tool logic with the given parameters. abstract ToolSafetyProfilegetToolSafetyProfile()Encodes both the distraction level and safety level of this tool. -
-
Method Detail
-
precondition
abstract VoiceToolResult precondition()
Precondition check that runs before execute. Can be called independently. Here you should do all licence checks and can use this function to decide if the tool should be registered or not.
-
getName
abstract String getName()
Unique identifier for the tool (e.g., "get_load_status"). Used by the voice assistant to invoke the tool.
-
getDescription
abstract String getDescription()
Human-readable description of what the tool does. The voice assistant uses this to decide when to call the tool.
-
getParamsClass
abstract KClass<T> getParamsClass()
The KClass of the parameters data class. Must be annotated with @Serializable.
-
getSchema
abstract String getSchema()
JSON schema auto-generated from paramsClass. Describes the expected input format to the voice assistant.
-
getExecute
abstract SuspendFunction1<T, VoiceToolResult> getExecute()
Suspending function that executes the tool logic with the given parameters.
-
getToolSafetyProfile
abstract ToolSafetyProfile getToolSafetyProfile()
Encodes both the distraction level and safety level of this tool. Use ToolSafetyProfile.SafeWhileDriving for tools safe to use while driving, and ToolSafetyProfile.RestrictedWhileDriving for tools that must not be used while driving.
-
-
-
-