MethodToolFactory

Factory interface for creating tools from annotated methods. Extended by Tool.Companion to provide Tool.fromMethod, Tool.fromInstance, etc.

Inheritors

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open fun fromInstance(instance: Any, objectMapper: <Error class: unknown class> = jacksonObjectMapper()): List<Tool>

Create Tools from all methods annotated with LlmTool on an instance.

Link copied to clipboard
open fun fromMethod(instance: Any, method: Method, objectMapper: <Error class: unknown class> = jacksonObjectMapper()): Tool

Create a Tool from a Java method annotated with LlmTool.

open fun fromMethod(instance: Any, method: KFunction<*>, objectMapper: <Error class: unknown class> = jacksonObjectMapper()): Tool

Create a Tool from a Kotlin method annotated with LlmTool.

Link copied to clipboard
open fun safelyFromInstance(instance: Any, objectMapper: <Error class: unknown class> = jacksonObjectMapper()): List<Tool>

Safely create Tools from an instance, returning empty list if no annotated methods found. This is useful when you want to scan an object that may or may not have tool methods.