# `MingaAgent.Tool.Registry`
[🔗](https://github.com/jsmestad/minga/blob/main/lib/minga_agent/tool/registry.ex#L1)

ETS-backed registry for agent tool specifications.

Stores `MingaAgent.Tool.Spec` structs in an ETS table with
`read_concurrency: true` for zero-contention lookups in the hot
tool-execution path. Writes happen only at startup (built-in tool
registration) and when extensions register custom tools.

## Built-in registration

On startup, all tools from `MingaAgent.Tools.all/1` are converted to
`Spec` structs and registered. The Registry becomes the single source
of truth for tool discovery and lookup.

## Usage

    MingaAgent.Tool.Registry.lookup("read_file")
    #=> {:ok, %MingaAgent.Tool.Spec{name: "read_file", ...}}

    MingaAgent.Tool.Registry.registered?("shell")
    #=> true

    MingaAgent.Tool.Registry.all()
    #=> [%MingaAgent.Tool.Spec{}, ...]

# `all`

```elixir
@spec all() :: [MingaAgent.Tool.Spec.t()]
```

Returns all registered tool specs.

# `from_req_tool`

```elixir
@spec from_req_tool(ReqLLM.Tool.t()) :: MingaAgent.Tool.Spec.t()
```

Converts a `ReqLLM.Tool` struct to a `MingaAgent.Tool.Spec`.

Maps the tool name to a category and approval level based on the
tool's characteristics.

# `lookup`

```elixir
@spec lookup(String.t()) :: {:ok, MingaAgent.Tool.Spec.t()} | :error
```

Looks up a tool spec by name.

Returns `{:ok, spec}` if found, `:error` otherwise.

# `register`

```elixir
@spec register(MingaAgent.Tool.Spec.t()) :: :ok
```

Registers a tool spec in the registry.

Overwrites any existing spec with the same name. Returns `:ok`.

# `registered?`

```elixir
@spec registered?(String.t()) :: boolean()
```

Returns true if a tool with the given name is registered.

# `start_link`

```elixir
@spec start_link(keyword()) :: GenServer.on_start()
```

Starts the registry GenServer that owns the ETS table.

---

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