Skip to main content

Module tool_node

Module tool_node 

Source
Expand description

The generic tool node and NativeTools, a ToolRuntime built from Rust closures.

The tool node calls one tool of a provider registered in the ToolRegistry service:

- id: weather
  type: tool
  provider_id: builtin          # or e.g. "mcp:github"
  tool_name: get_weather
  tool_parameters:
    city:  { type: variable, value: [start, city] }
    units: { type: constant, value: metric }
    note:  { type: mixed,    value: "asked by {{#sys.user_id#}}" }

A simpler arguments map is also accepted: string values are templates (a lone {{#a.b#}} placeholder keeps its typed value), other values are constants.

Outputs: text (string), json (structured result, or null; when the text looks like JSON but does not parse, metadata json_error says why), files (array, currently always empty), is_error (bool) and error (the tool’s error text, or null). A tool-reported error fails the node unless ignore_tool_errors is set, in which case is_error / error let a downstream branch react. variable arguments that do not resolve are sent as null and listed in metadata missing_arguments.

Structs§

NativeTools
A ToolRuntime whose tools are Rust closures.
ToolNode
Calls one tool from the ToolRegistry service.

Constants§

KIND
Node kind handled by ToolNode.

Functions§

descriptor
Catalog descriptor of the tool node.
register
Register the tool node kind.