Package org.machanism.machai.ai.tools


package org.machanism.machai.ai.tools
Provides the service-provider infrastructure for exposing host-defined functions as tools that can be registered with generative AI providers.

This package defines the contracts and loader used to publish local application capabilities to a Genai instance. Implementations of FunctionTools register one or more named tools, while ToolFunction represents the executable callback invoked when a provider requests a tool execution. FunctionToolsLoader discovers available tool providers through Java's ServiceLoader mechanism and applies them to a target provider.

Tool implementations in this package are intended to bridge provider-initiated tool calls to controlled host-side functionality such as file access, HTTP retrieval, command execution, or other application-specific operations. When available, a Configurator can be supplied to tool providers so they can resolve runtime configuration before registering tools.

Typical usage


 Configurator configurator = ...;
 Genai provider = ...;

 FunctionToolsLoader loader = new FunctionToolsLoader();
 loader.applyTools(provider, configurator);
 

Configuration values may contain placeholders such as ${...}; when supported by a tool provider, these placeholders are resolved through the supplied configurator while unresolved values remain unchanged.