runTool

suspend fun runTool(name: String, arguments: Map<String, Any?> = emptyMap(), userInitiated: Boolean = false): Any?

Runs one of the app's tools for a reply's UI, such as to load data on this device.

Return

The tool's output, as plain Kotlin values.

Parameters

name

The tool's name.

arguments

Its arguments, as plain Kotlin values.

userInitiated

Whether the person asked for it, such as with a tap, rather than the UI while it shows. Only a read-only tool runs when they didn't.

Throws

When the host has no such tool, it is not read-only and the person did not ask for it, it fails or throws, or its output is not JSON.