# `Nous.Tool.Registry`
[🔗](https://github.com/nyo16/nous/blob/v0.21.1/lib/nous/tool/registry.ex#L1)

Stateless helpers for building and querying tool collections.

Provides functions to create `Nous.Tool` structs from behaviour modules,
filter by category or tags, and look up tools by name.

## Architecture

The registry is a pure-functional module operating on plain lists of
`Nous.Tool.t()` structs. No GenServer or ETS — just pass a list in,
get a list out.

## Quick Start

    tools = Nous.Tool.Registry.from_modules([
      MyApp.Tools.FileRead,
      MyApp.Tools.FileWrite,
      MyApp.Tools.GitStatus
    ])

    # Filter to read-only tools
    read_tools = Nous.Tool.Registry.filter(tools, category: :read)

    # Filter by tag
    git_tools = Nous.Tool.Registry.filter(tools, tags: [:git])

    # Look up by name
    {:ok, tool} = Nous.Tool.Registry.lookup(tools, "file_read")

# `filter`

```elixir
@spec filter([Nous.Tool.t()], keyword()) :: [Nous.Tool.t()]
```

Filter tools by category and/or tags.

When both `:category` and `:tags` are given, a tool must match the
category AND have at least one of the specified tags.

## Options

  * `:category` - Filter to tools with this category
  * `:tags` - Filter to tools having at least one of these tags

## Examples

    # By category
    Registry.filter(tools, category: :read)

    # By tags (tool must have at least one matching tag)
    Registry.filter(tools, tags: [:file, :git])

    # Both (must match category AND have at least one tag)
    Registry.filter(tools, category: :read, tags: [:file])

# `from_modules`

```elixir
@spec from_modules([module()], keyword()) :: [Nous.Tool.t()]
```

Build a list of tools from behaviour modules.

Each module must implement `Nous.Tool.Behaviour`. Options are passed
through to `Nous.Tool.from_module/2` for each module.

## Options

  * Any option accepted by `Nous.Tool.from_module/2` (applied to all modules)

## Examples

    tools = Registry.from_modules([MyApp.Tools.Search, MyApp.Tools.FileRead])

    tools = Registry.from_modules([MyApp.Tools.Search], timeout: 60_000)

# `lookup`

```elixir
@spec lookup([Nous.Tool.t()], String.t()) ::
  {:ok, Nous.Tool.t()} | {:error, :not_found}
```

Look up a tool by name.

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

## Examples

    {:ok, tool} = Registry.lookup(tools, "file_read")
    {:error, :not_found} = Registry.lookup(tools, "nonexistent")

---

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