Main UTCP client implementation.
This module provides the primary interface for interacting with UTCP providers and tools. It manages provider registration, tool discovery, and tool execution.
Summary
Functions
Calls a specific tool with the given arguments.
Calls a tool with streaming support.
Returns a specification to start this module under a supervisor.
Converts multiple OpenAPI specifications to UTCP tools and registers them.
Converts an OpenAPI specification to UTCP tools and registers them.
Deregisters a tool provider.
Finds similar tools based on a reference tool.
Gets the client configuration.
Gets health status for the client and its components.
Gets monitoring metrics for the client.
Gets performance summary for client operations.
Gets search suggestions based on partial query.
Gets repository statistics.
Gets all available transports.
Registers a tool provider and returns the discovered tools.
Searches for providers using advanced search algorithms.
Searches for tools using advanced search algorithms.
Starts a new UTCP client with the given configuration.
Starts a new UTCP client with the given configuration and name.
Validates an OpenAPI specification.
Functions
@spec call_tool(GenServer.server(), String.t(), map()) :: ExUtcp.Types.call_result()
Calls a specific tool with the given arguments.
@spec call_tool_stream(GenServer.server(), String.t(), map()) :: {:ok, ExUtcp.Types.stream_result()} | {:error, any()}
Calls a tool with streaming support.
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec convert_multiple_openapi(GenServer.server(), list(), keyword()) :: ExUtcp.Types.register_result()
Converts multiple OpenAPI specifications to UTCP tools and registers them.
Parameters
client: UTCP clientspecs: List of OpenAPI specificationsopts: Conversion options
Returns
{:ok, tools} on success, {:error, reason} on failure.
@spec convert_openapi(GenServer.server(), map() | String.t(), keyword()) :: ExUtcp.Types.register_result()
Converts an OpenAPI specification to UTCP tools and registers them.
Parameters
client: UTCP clientspec: OpenAPI specification (map, URL, or file path)opts: Conversion options
Returns
{:ok, tools} on success, {:error, reason} on failure.
@spec deregister_tool_provider(GenServer.server(), String.t()) :: ExUtcp.Types.deregister_result()
Deregisters a tool provider.
@spec find_similar_tools(GenServer.server(), String.t(), keyword()) :: [map()]
Finds similar tools based on a reference tool.
Parameters
client: UTCP clienttool_name: Name of the reference toolopts: Similarity search options
Returns
List of similar tools with similarity scores.
@spec get_config(GenServer.server()) :: ExUtcp.Types.client_config()
Gets the client configuration.
@spec get_health_status(GenServer.server()) :: map()
Gets health status for the client and its components.
Parameters
client: UTCP client
Returns
Map containing health status information.
@spec get_monitoring_metrics(GenServer.server()) :: map()
Gets monitoring metrics for the client.
Parameters
client: UTCP client
Returns
Map containing current metrics and performance data.
@spec get_performance_summary(GenServer.server()) :: map()
Gets performance summary for client operations.
Parameters
client: UTCP client
Returns
Map containing performance statistics and alerts.
@spec get_search_suggestions(GenServer.server(), String.t(), keyword()) :: [ String.t() ]
Gets search suggestions based on partial query.
Parameters
client: UTCP clientpartial_query: Partial search queryopts: Suggestion options
Returns
List of suggested search terms.
@spec get_stats(GenServer.server()) :: map()
Gets repository statistics.
@spec get_transports(GenServer.server()) :: %{required(String.t()) => module()}
Gets all available transports.
@spec register_tool_provider(GenServer.server(), ExUtcp.Types.provider()) :: ExUtcp.Types.register_result()
Registers a tool provider and returns the discovered tools.
@spec search_providers(GenServer.server(), String.t(), map()) :: [map()]
Searches for providers using advanced search algorithms.
Parameters
client: UTCP clientquery: Search query stringopts: Search options
Returns
List of search results with providers, scores, and match information.
@spec search_tools(GenServer.server(), String.t(), map()) :: [map()]
Searches for tools using advanced search algorithms.
Parameters
client: UTCP clientquery: Search query stringopts: Search options including algorithm, filters, and limits
Options
:algorithm- Search algorithm (:exact, :fuzzy, :semantic, :combined):filters- Map with provider, transport, and tag filters:limit- Maximum number of results (default: 20):threshold- Minimum similarity threshold (default: 0.1):security_scan- Enable security scanning (default: false):filter_sensitive- Filter out tools with sensitive data (default: false)
Returns
List of search results with tools, scores, and match information.
@spec start_link(ExUtcp.Types.client_config()) :: GenServer.on_start()
Starts a new UTCP client with the given configuration.
@spec start_link(ExUtcp.Types.client_config(), GenServer.name()) :: GenServer.on_start()
Starts a new UTCP client with the given configuration and name.
@spec validate_openapi(GenServer.server(), map()) :: {:ok, map()} | {:error, term()}
Validates an OpenAPI specification.
Parameters
client: UTCP clientspec: OpenAPI specification
Returns
{:ok, validation_result} on success, {:error, reason} on failure.