Package org.machanism.machai.ai.tools
Genai provider.
This package contains the service-provider interface and concrete tool installers used to expose selected host functionality to AI provider implementations. The tools in this package focus on capabilities that are commonly needed during assisted development workflows, such as command execution, HTTP access, and package-level tool discovery and registration.
Package responsibilities
- Define the
FunctionToolsSPI used by tool installers. - Discover and apply tool installers through
FunctionToolsLoader. - Provide host-managed command execution with validation and bounded output capture.
- Provide HTTP and REST access helpers for web content retrieval and API invocation.
- Support security-related checks and utility types used by installed tools.
Key types
FunctionTools- SPI for registering tools with a provider.FunctionToolsLoader- singleton loader that discovers and applies tool installers.CommandFunctionTools- installs command execution and termination tools.WebFunctionTools- installs web content and REST API tools.CommandSecurityChecker- evaluates deny-list rules for command validation.LimitedStringBuilder- retains only the trailing portion of large text output.
Usage notes
Tool implementations are executed within the host application rather than by the model itself. As a result, callers should ensure that working directories, network access, configuration values, and security policies are supplied and enforced by the surrounding runtime. Paths are expected to be resolved relative to a host-provided project directory, and configuration placeholders may be resolved through an injected configurator.
-
ClassDescriptionInstalls command-execution and process-termination tools into a
Genai.Runtime exception used byterminate_processto signal early termination to the host.Loads and evaluates command deny-list rules used by host-side command execution tools.Exception thrown when a command fails a deny-list security check.Service-provider interface (SPI) for installing host-provided function tools into aGenai.Discovers and appliesFunctionToolsimplementations usingServiceLoader.AStringBuilder-like helper that retains only the lastmaxSizecharacters.Functional interface representing a tool callable by a provider during a run.Installs HTTP retrieval tools into aGenai.