Skip to main content

Module tool

Module tool 

Source
Expand description

Tool trait — the interface every callable tool implements.

The LLM sees tools via ToolSchema (name, description, JSON schema). When the LLM emits a ToolCall, the engine looks up the tool by name and calls Tool::execute with the args.

Two implementations ship with the library:

  • FunctionTool — wraps any async function as a tool
  • MCP adapter (future plan) — bridges external MCP servers

Structs§

FunctionTool
Convenience wrapper: turns any async function into a Tool.
StructuredFunctionTool
Like FunctionTool, but returns structured ToolResult with metadata.
ToolResult
Structured result from tool execution.

Traits§

Tool
A callable tool the LLM can invoke via tool_calls.

Type Aliases§

StructuredToolFunc
Type alias for the async function returning a structured ToolResult.
ToolFunc
Type alias for the async function signature used by FunctionTool.
ToolFuture
Type-erased async future returned by Tool::execute.
ToolResultFuture
Type-erased async future for structured tool results.