Pure functions for resolving builtin tool families into tool maps.
Extracted from PtcRunner.SubAgent to break a runtime dependency cycle
between SubAgent, Loop, and SystemPrompt.
Summary
Functions
Returns the agent's tools with builtin tools injected.
Expands a list of builtin tool family atoms to [{name, sentinel}] pairs.
Functions
Returns the agent's tools with builtin tools injected.
Merges llm_query and builtin_tools families into the tools map.
User-defined tools are never overwritten by builtins.
Examples
iex> agent = PtcRunner.SubAgent.new(prompt: "test", builtin_tools: [:grep])
iex> tools = PtcRunner.SubAgent.BuiltinTools.effective_tools(agent)
iex> Map.has_key?(tools, "grep")
true
iex> agent = PtcRunner.SubAgent.new(prompt: "test", builtin_tools: [:grep], tools: %{"grep" => fn _ -> :custom end})
iex> tools = PtcRunner.SubAgent.BuiltinTools.effective_tools(agent)
iex> is_function(tools["grep"])
true
Expands a list of builtin tool family atoms to [{name, sentinel}] pairs.
Useful for external modules that need to generate tool descriptions for builtins without reaching into SubAgent internals.
Examples
iex> PtcRunner.SubAgent.BuiltinTools.expand_builtin_tools([:grep])
[{"grep", :builtin_grep}, {"grep-n", :builtin_grep_n}]
iex> PtcRunner.SubAgent.BuiltinTools.expand_builtin_tools([])
[]