Resolves tools into ExAthena.Tool.Spec structs for the provider and loop.
Consumers supply tools in one of two ways:
At config time:
config :ex_athena, tools: [MyApp.ToolA, MyApp.ToolB]Per-call:
ExAthena.Loop.run(messages, tools: [MyApp.ToolA, ExAthena.Tools.Read])
Per-call wins; the configured list is the default when no tools are passed.
resolve/1 returns [ExAthena.Tool.Spec.t()]. Built-in modules are wrapped
into :module specs; MCP-discovered tools are appended as :mcp specs
(unless suppressed via mcp: false).
Summary
Functions
List the builtin tool modules.
Build the prompt-friendly list used by ExAthena.ToolCalls.augment_system_prompt/3
when we fall back to the TextTagged protocol.
Build the provider-facing tool schema list — the same shape Ollama / OpenAI-compatible providers send on the wire.
Find the spec that handles a call by name.
Resolve the tools to use for a call. Returns [Tool.Spec.t()].
Validate a list of specs. Raises if any module spec's module doesn't implement the Tool behaviour.
Functions
@spec builtins() :: [module()]
List the builtin tool modules.
@spec describe_for_prompt([ExAthena.Tool.Spec.t()]) :: [map()]
Build the prompt-friendly list used by ExAthena.ToolCalls.augment_system_prompt/3
when we fall back to the TextTagged protocol.
@spec describe_for_provider([ExAthena.Tool.Spec.t()]) :: [map()]
Build the provider-facing tool schema list — the same shape Ollama / OpenAI-compatible providers send on the wire.
@spec find([ExAthena.Tool.Spec.t()], String.t()) :: ExAthena.Tool.Spec.t() | nil
Find the spec that handles a call by name.
@spec resolve(keyword()) :: [ExAthena.Tool.Spec.t()]
Resolve the tools to use for a call. Returns [Tool.Spec.t()].
Accepts:
- a list of modules (each wrapped into a
:modulespec) :all— every builtin as specsnil— falls back toconfig :ex_athena, tools: ...or:all
Options:
mcp: true | false | [server_name]— controls MCP tool inclusion. Defaults totruewhen the MCP supervisor is running,falseotherwise. Passfalseto suppress MCP tools entirely; pass a list of server names to include only tools from those servers.
@spec validate!([ExAthena.Tool.Spec.t()]) :: :ok
Validate a list of specs. Raises if any module spec's module doesn't implement the Tool behaviour.