mix tool_call. export
(ToolCall v0.1.0)
Copy Markdown
Exports the schemas derived by use ToolCall as JSON.
mix tool_call.export
mix tool_call.export MyApp.Tools.Weather MyApp.Tools.Math
mix tool_call.export --format anthropic
mix tool_call.export --format mcp --out priv/tools.json
mix tool_call.export --strictWithout module arguments every module of the current application that exports
__tools__/0 is used; --app selects another application. Discovery loads
those modules (Code.ensure_loaded?/1), so @on_load callbacks run; pass
module names to avoid it. Output is indented JSON with sorted keys, and
modules and tools keep a stable order, so a file checked into the repository is
reproducible.
Formats
openai(default) - an array of OpenAI function objects, i.e. thetoolsparameter of Chat Completionsanthropic- an array of{name, description, input_schema}objectsmcp- an MCPtools/listresult:{"tools": [{"name": ..., "description": ..., "inputSchema": ...}]}
Options
--format,-f-openai(default),anthropicormcp--out,-o- write to a file instead of stdout--app,-a- application to discover tool modules in--strict- emit the strict JSON Schema subset for OpenAI and MCP; ignored byanthropic
Formatting uses json:format/1, which is why the project floor is Erlang/OTP
27.1+. The formatter belongs to OTP, so a file is reproducible per OTP version
and may reflow after an upgrade.