create

fun create(name: String, description: String, handler: Tool.Handler): Tool

Create a tool with no parameters (Java-friendly). This method is easier to call from Java as it uses the Handler interface.

Example:

Tool tool = Tool.create("greet", "Greets user", input -> Tool.Result.text("Hello!"));

Return

A new Tool instance

Parameters

name

Tool name

description

Tool description

handler

Handler that processes input and returns a result


fun create(name: String, description: String, metadata: Tool.Metadata, handler: Tool.Handler): Tool

Create a tool with custom metadata (Java-friendly).

Return

A new Tool instance

Parameters

name

Tool name

description

Tool description

metadata

Tool metadata (e.g., returnDirect)

handler

Handler that processes input and returns a result


fun create(name: String, description: String, inputSchema: Tool.InputSchema, handler: Tool.Handler): Tool

Create a tool with input schema (Java-friendly).

Return

A new Tool instance

Parameters

name

Tool name

description

Tool description

inputSchema

Schema describing the input parameters

handler

Handler that processes input and returns a result


fun create(name: String, description: String, inputSchema: Tool.InputSchema, metadata: Tool.Metadata, handler: Tool.Handler): Tool

Create a fully configured tool (Java-friendly).

Return

A new Tool instance

Parameters

name

Tool name

description

Tool description

inputSchema

Schema describing the input parameters

metadata

Tool metadata

handler

Handler that processes input and returns a result