ADK.Tool behaviour (ADK v0.0.1-alpha.1)

Copy Markdown View Source

The tool behaviour. Tools are functions that agents can call.

Summary

Callbacks

Human-readable description.

Tool name for LLM function calling.

JSON Schema for parameters.

Execute the tool.

Functions

Check if a tool is a Gemini built-in (google_search, code_execution, etc).

Build a function declaration from a tool struct.

Types

result()

@type result() :: {:ok, term()} | {:error, term()}

Callbacks

description()

@callback description() :: String.t()

Human-readable description.

name()

@callback name() :: String.t()

Tool name for LLM function calling.

parameters()

(optional)
@callback parameters() :: map()

JSON Schema for parameters.

run(ctx, args)

@callback run(ctx :: ADK.ToolContext.t(), args :: map()) :: result()

Execute the tool.

Functions

builtin?(arg1)

@spec builtin?(map()) :: boolean()

Check if a tool is a Gemini built-in (google_search, code_execution, etc).

Built-in tools are sent to the Gemini API as native capability flags rather than function declarations.

declaration(map)

@spec declaration(map()) :: map()

Build a function declaration from a tool struct.