fromFunction

open override fun <I : Any, O : Any> fromFunction(name: String, description: String, inputType: Class<I>, outputType: Class<O>, function: Function<I, O>): Tool

Create a tool with strongly typed input and output (Java-friendly).

Return

A new Tool instance

Parameters

I

Input type - will be deserialized from JSON

O

Output type - will be serialized to JSON

name

Tool name

description

Tool description

inputType

Class of the input type

outputType

Class of the output type

function

Function that processes typed input and returns typed output


open override fun <I : Any, O : Any> fromFunction(name: String, description: String, inputType: Class<I>, outputType: Class<O>, metadata: Tool.Metadata, function: Function<I, O>): Tool

Create a tool with strongly typed input and output with custom metadata (Java-friendly).

Return

A new Tool instance

Parameters

I

Input type - will be deserialized from JSON

O

Output type - will be serialized to JSON

name

Tool name

description

Tool description

inputType

Class of the input type

outputType

Class of the output type

metadata

Tool metadata

function

Function that processes typed input and returns typed output


open override fun <I : Any, O : Any> fromFunction(name: String, description: String, inputType: Class<I>, outputType: Class<O>, metadata: Tool.Metadata, objectMapper: <Error class: unknown class>, function: Function<I, O>): Tool

Create a tool with strongly typed input and output with custom ObjectMapper (Java-friendly).

Return

A new Tool instance

Parameters

I

Input type - will be deserialized from JSON

O

Output type - will be serialized to JSON

name

Tool name

description

Tool description

inputType

Class of the input type

outputType

Class of the output type

metadata

Tool metadata

objectMapper

ObjectMapper for JSON serialization/deserialization

function

Function that processes typed input and returns typed output