requireType

fun <T : Any> Tool.requireType(type: Class<T>, messageProvider: (String) -> String? = { null }): Tool

Wrap this tool to require a value of type T before execution.

Parameters

T

The type of value to request

type

The class of the requested type

messageProvider

Function to generate the request message from input


inline fun <T : Any> Tool.requireType(message: String? = null): Tool

Wrap this tool to require a value of type T before execution (reified).

Parameters

T

The type of value to request

message

Optional message explaining what's needed