Converts Nodes into ReqLLM Tool structs for LLM function calling.
Bridges the gap between Node metadata and ReqLLM.Tool structs.
Three operations handle the full round-trip: Node → tool description,
tool call → context, and execution result → tool result message.
Summary
Functions
Converts tool call arguments to a context map for node execution.
Converts a Node or action module into a ReqLLM.Tool struct.
Builds a normalized tool result from node execution output.
Functions
Converts tool call arguments to a context map for node execution.
Atomizes string keys so that the resulting map matches the keyword-style
keys nodes expect. When valid_keys is provided, only keys in the set
are accepted; otherwise falls back to String.to_existing_atom/1.
@spec to_tool( Jido.Composer.Node.ActionNode.t() | Jido.Composer.Node.AgentNode.t() | struct() | module() ) :: ReqLLM.Tool.t()
Converts a Node or action module into a ReqLLM.Tool struct.
Returns %ReqLLM.Tool{} with name, description, parameter_schema (JSON Schema map),
and a no-op callback (the orchestrator executes tools externally).
Node structs delegate to their to_tool_spec/1 callback. Raw action modules
are handled directly for the termination tool use case.
@spec to_tool_result( String.t(), String.t(), {:ok, map() | Jido.Composer.NodeIO.t()} | {:error, term()} ) :: map()
Builds a normalized tool result from node execution output.
Returns %{id, name, result} for feeding back into the LLM conversation.