ExUtcp.Repository (ex_utcp v0.2.8)

View Source

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.

Summary

Functions

Adds a tool to the repository.

Clears all providers and tools from the repository.

Gets a provider by name.

Gets all providers.

Gets a tool by name.

Gets all tools.

Gets tools by provider name.

Checks if a provider exists.

Checks if a tool exists.

Creates a new in-memory tool repository.

Gets the count of providers in the repository.

Removes a provider and its tools.

Removes a specific tool.

Saves a provider with its associated tools.

Searches for tools matching a query.

Gets the count of tools in the repository.

Functions

add_tool(repo, tool)

Adds a tool to the repository.

clear(repo)

Clears all providers and tools from the repository.

get_provider(repo, provider_name)

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

Gets a provider by name.

get_providers(repo)

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

Gets all providers.

get_tool(repo, tool_name)

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

Gets a tool by name.

get_tools(repo)

Gets all tools.

get_tools_by_provider(repo, provider_name)

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

Gets tools by provider name.

has_provider?(repo, provider_name)

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

Checks if a provider exists.

has_tool?(repo, tool_name)

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

Checks if a tool exists.

new()

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

Creates a new in-memory tool repository.

provider_count(repo)

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

Gets the count of providers in the repository.

remove_provider(repo, provider_name)

Removes a provider and its tools.

remove_tool(repo, tool_name)

Removes a specific tool.

save_provider_with_tools(repo, provider, tools)

Saves a provider with its associated tools.

search_tools(repo, query, limit)

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

Searches for tools matching a query.

tool_count(repo)

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

Gets the count of tools in the repository.