# `ExUtcp.Search.Engine`
[🔗](https://github.com/universal-tool-calling-protocol/elixir-utcp/blob/main/lib/ex_utcp/search/engine.ex#L1)

Search engine for managing and indexing UTCP tools and providers.

The engine maintains an in-memory index of tools and providers for fast searching.

# `t`

```elixir
@type t() :: %ExUtcp.Search.Engine{
  config: map(),
  providers_index: %{required(String.t()) =&gt; map()},
  tools_index: %{required(String.t()) =&gt; ExUtcp.Types.tool()}
}
```

# `add_provider`

```elixir
@spec add_provider(t() | pid(), map()) :: t() | :ok
```

Adds a provider to the search index.

# `add_tool`

```elixir
@spec add_tool(t() | pid(), ExUtcp.Types.tool()) :: t() | :ok
```

Adds a tool to the search index.

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `clear`

```elixir
@spec clear(t() | pid()) :: t() | :ok
```

Clears all tools and providers from the search index.

# `get_all_providers`

```elixir
@spec get_all_providers(t() | pid()) :: [map()]
```

Gets all providers from the search index.

# `get_all_tools`

```elixir
@spec get_all_tools(t() | pid()) :: [ExUtcp.Types.tool()]
```

Gets all tools from the search index.

# `get_provider`

```elixir
@spec get_provider(t() | pid(), String.t()) :: map() | nil
```

Gets a provider by name.

# `get_tool`

```elixir
@spec get_tool(t() | pid(), String.t()) :: ExUtcp.Types.tool() | nil
```

Gets a tool by name.

# `new`

```elixir
@spec new(keyword()) :: %ExUtcp.Search.Engine{
  config: %{
    enable_caching: boolean(),
    fuzzy_threshold: float(),
    max_results: integer(),
    semantic_threshold: float()
  },
  providers_index: %{required(String.t()) =&gt; map()},
  tools_index: %{required(String.t()) =&gt; ExUtcp.Types.tool()}
}
```

Creates a new search engine.

# `remove_provider`

```elixir
@spec remove_provider(t() | pid(), String.t()) :: t() | :ok
```

Removes a provider from the search index.

# `remove_tool`

```elixir
@spec remove_tool(t() | pid(), String.t()) :: t() | :ok
```

Removes a tool from the search index.

# `start_link`

```elixir
@spec start_link(keyword()) :: {:ok, pid()} | {:error, term()}
```

Starts the search engine as a GenServer.

# `stats`

```elixir
@spec stats(t() | pid()) :: map()
```

Gets search engine statistics.

---

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