Class CommandSpecFunctionTools

java.lang.Object
org.machanism.machai.gw.tools.CommandSpecFunctionTools
All Implemented Interfaces:
FunctionTools

public class CommandSpecFunctionTools extends Object implements FunctionTools
Provides function tools for task and execution control within the AIFileProcessor context.

This class registers tools for terminating execution and ending tasks in a controlled manner. It is intended for use with AIFileProcessor and integrates with the Genai provider.

Author:
Viktor Tovstyi
  • Constructor Details

    • CommandSpecFunctionTools

      public CommandSpecFunctionTools()
  • Method Details

    • terminateExecution

      public String terminateExecution(String message, int exitCode, File projectDir)
      Terminates the application by throwing a ProcessTerminationException.

      Reads message and exitCode from the supplied JsonNode and throws a ProcessTerminationException. This mechanism allows a tool invocation to abort the overall workflow with an explicit exit code.

    • endTask

      public String endTask(String message)
      Completes the current task by throwing an EndTaskException.

      This method is intended to be used as a function tool for terminating a process when requested by the user or dictated by process logic. It logs the task completion and uses a custom message if provided in the properties.