# `mix tool_call.export`

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 --strict

Without 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. the `tools`
    parameter of Chat Completions
  * `anthropic` - an array of `{name, description, input_schema}` objects
  * `mcp` - an MCP `tools/list` result:
    `{"tools": [{"name": ..., "description": ..., "inputSchema": ...}]}`

## Options

  * `--format`, `-f` - `openai` (default), `anthropic` or `mcp`
  * `--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 by `anthropic`

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.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
