# `ToolCall.TypeCompiler`

Compiles a declaration's `ToolCall.TypeExpr` values into `ToolCall.IR.Type`.

The compiler owns local-type expansion, recursive `$defs` hoisting, provider
mapping, and result-type handling; the declaration source has already resolved
aliases, current-module references, and `when` bindings. The builder remains
responsible for docs, defaults, parameter names, and overrides.

# `context`

```elixir
@type context() :: map()
```

# `prepared`

```elixir
@type prepared() :: %{context: context(), definitions: map(), cyclic: MapSet.t()}
```

# `t`

```elixir
@type t() :: %{
  context: context(),
  definitions: map(),
  cyclic: MapSet.t(),
  defs: map()
}
```

# `compile_param`

```elixir
@spec compile_param(t(), ToolCall.TypeExpr.t()) ::
  {ToolCall.IR.Type.t(), boolean(), t()}
```

# `compile_result`

```elixir
@spec compile_result(t(), ToolCall.TypeExpr.t()) ::
  {ToolCall.IR.Type.t() | nil, boolean(), t()}
```

# `defs`

```elixir
@spec defs(t()) :: map()
```

# `new`

```elixir
@spec new(prepared()) :: t()
```

# `prepare`

```elixir
@spec prepare(context()) :: prepared()
```

Converts the module's local type definitions once.

The result is shared by every tool in the module; `new/1` only resets the
per-tool `$defs` budget.

---

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