asToolDescriptor
fun KFunction<*>.asToolDescriptor(name: String? = null, description: String? = null): ToolDescriptor(source)
Converts a KFunction into a ToolDescriptor that provides detailed metadata about the tool's name, description, and parameter requirements. This can be used to programmatically describe and interact with a tool function.
Return
A ToolDescriptor containing the tool's name, description, required parameters, and optional parameters.
Parameters
name
An optional custom name for the tool. If not provided, the name is derived from annotations or the function name.
description
An optional custom description for the tool. If not provided, the description is derived from annotations or the function name.