Skip to main content

Module tools

Module tools 

Source
Expand description

Tool (function) calling: tool declarations in each model family’s own syntax, parsing of the calls a model emits, and a few built-in tools for the command line. The host runs the tools; chat::ChatFormat feeds the results back in the format the model was trained on.

Gemma 4 declares tools as <|tool>declaration:NAME{...}<tool|> in the system turn and calls them with <|tool_call>call:NAME{key:<|"|>value<|"|>}<tool_call|>; Qwen 3.5 / 3.8 lists JSON schemas inside <tools> and calls with <tool_call><function=NAME><parameter=key>value </parameter></function></tool_call>.

Modules§

calc
A small arithmetic evaluator for the calculate tool.
gemma
qwen

Structs§

ToolCall
ToolResult
ToolSpec
A tool the model may call: a name, what it does, and a JSON schema (type: object) for its arguments.

Functions§

builtin_specs
default_system_prompt
The default system prompt of the command line.
local_now
Local wall-clock time: (YYYY-MM-DD HH:MM:SS, weekday, UTC offset in seconds, zone name).
now_string
“2026-10-24 14:05:09 Friday (UTC+09:00, JST)”.
run_builtin
Runs a built-in tool; unknown tools and bad arguments come back as error text for the model.