Canonical, unified representation of a tool — whether backed by a behaviour-implementing module or a dynamically-discovered MCP tool.
Kinds
:module— wraps a module that implementsExAthena.Tool. All fields are populated from the module's callbacks at construction time.:mcp— wraps a tool discovered from an MCP server. The tool name is namespaced as"<server>_<tool>". MCP tools are never assumed parallel-safe.
Construction
spec = ExAthena.Tool.Spec.from_module(MyApp.ReadTool)
spec = ExAthena.Tool.Spec.from_mcp(tool_map, "myserver")Dispatch
ExAthena.Tool.Spec.execute(spec, args, ctx)
Summary
Functions
Execute the tool with args and ctx.
Build a spec from an MCP tool map and server name.
Build a spec from a module implementing ExAthena.Tool.
Return the cached parallel_safe? flag.
Types
Functions
@spec execute(t(), map(), ExAthena.ToolContext.t()) :: {:ok, term()} | {:error, term()} | {:halt, term()}
Execute the tool with args and ctx.
Dispatches to module.execute/2 for :module specs, and to
ExAthena.Mcp.Tool.execute/3 for :mcp specs.
Build a spec from an MCP tool map and server name.
tool_map is a map with string keys "name", "description", and
"inputSchema" as returned by tools/list. The resulting spec's :name
is "<server>_<tool>".
Build a spec from a module implementing ExAthena.Tool.
Return the cached parallel_safe? flag.