Interface FunctionTools

All Known Implementing Classes:
CommandFunctionTools, WebFunctionTools

public interface FunctionTools
Service-provider interface (SPI) for installing host-provided function tools into a Genai.

Implementations contribute one or more named tools via Genai.addTool(String, String, org.machanism.machai.ai.provider.Genai.ToolFunction, String...). Tools are typically discovered via ServiceLoader and applied at runtime by FunctionToolsLoader.

Implementations may optionally accept a Configurator via setConfigurator(Configurator) to resolve runtime configuration (for example, API tokens for web calls).

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    applyTools(Genai provider)
    Registers this tool set with the given provider.
    default String
    replace(String value, Configurator conf)
    Resolves ${...} placeholders using the provided configurator.
    default void
    Provides a configurator instance to the tool set.
  • Method Details

    • applyTools

      void applyTools(Genai provider)
      Registers this tool set with the given provider.
      Parameters:
      provider - provider to register tools with
    • setConfigurator

      default void setConfigurator(Configurator configurator)
      Provides a configurator instance to the tool set.

      The default implementation does nothing.

      Parameters:
      configurator - configurator to use for runtime value resolution
    • replace

      default String replace(String value, Configurator conf)
      Resolves ${...} placeholders using the provided configurator.

      Unresolvable placeholders are left as-is.

      Parameters:
      value - raw value that may contain placeholders
      conf - configurator used for lookup; if null, the value is returned unchanged
      Returns:
      resolved value