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

In-memory repository for storing providers and tools.

This module provides a simple in-memory storage solution for UTCP providers and tools.
In a production environment, you might want to implement a persistent storage backend.

# `add_tool`

```elixir
@spec add_tool(ExUtcp.Types.tool_repository(), ExUtcp.Types.tool()) ::
  {:ok, ExUtcp.Types.tool_repository()} | {:error, String.t()}
```

Adds a tool to the repository.

# `clear`

```elixir
@spec clear(ExUtcp.Types.tool_repository()) :: ExUtcp.Types.tool_repository()
```

Clears all providers and tools from the repository.

# `get_provider`

```elixir
@spec get_provider(ExUtcp.Types.tool_repository(), String.t()) ::
  ExUtcp.Types.provider() | nil
```

Gets a provider by name.

# `get_providers`

```elixir
@spec get_providers(ExUtcp.Types.tool_repository()) :: [ExUtcp.Types.provider()]
```

Gets all providers.

# `get_tool`

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

Gets a tool by name.

# `get_tools`

```elixir
@spec get_tools(ExUtcp.Types.tool_repository()) :: [ExUtcp.Types.tool()]
```

Gets all tools.

# `get_tools_by_provider`

```elixir
@spec get_tools_by_provider(ExUtcp.Types.tool_repository(), String.t()) :: [
  ExUtcp.Types.tool()
]
```

Gets tools by provider name.

# `has_provider?`

```elixir
@spec has_provider?(ExUtcp.Types.tool_repository(), String.t()) :: boolean()
```

Checks if a provider exists.

# `has_tool?`

```elixir
@spec has_tool?(ExUtcp.Types.tool_repository(), String.t()) :: boolean()
```

Checks if a tool exists.

# `new`

```elixir
@spec new() :: ExUtcp.Types.tool_repository()
```

Creates a new in-memory tool repository.

# `provider_count`

```elixir
@spec provider_count(ExUtcp.Types.tool_repository()) :: integer()
```

Gets the count of providers in the repository.

# `remove_provider`

```elixir
@spec remove_provider(ExUtcp.Types.tool_repository(), String.t()) ::
  ExUtcp.Types.tool_repository()
```

Removes a provider and its tools.

# `remove_tool`

```elixir
@spec remove_tool(ExUtcp.Types.tool_repository(), String.t()) ::
  ExUtcp.Types.tool_repository()
```

Removes a specific tool.

# `save_provider_with_tools`

```elixir
@spec save_provider_with_tools(
  ExUtcp.Types.tool_repository(),
  ExUtcp.Types.provider(),
  [
    ExUtcp.Types.tool()
  ]
) :: ExUtcp.Types.tool_repository()
```

Saves a provider with its associated tools.

# `search_tools`

```elixir
@spec search_tools(ExUtcp.Types.tool_repository(), String.t(), integer()) :: [
  ExUtcp.Types.tool()
]
```

Searches for tools matching a query.

# `tool_count`

```elixir
@spec tool_count(ExUtcp.Types.tool_repository()) :: integer()
```

Gets the count of tools in the repository.

---

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