Class Tool

java.lang.Object
me.neurodock.plugin.tool.Tool

public abstract class Tool extends Object
  • Field Details

    • PLUGIN

      protected final Plugin PLUGIN
      The parent plugin of this tool, used by getToolJSON().
  • Constructor Details

    • Tool

      public Tool(Plugin plugin)
      A base contructor, as the Plugin is used within this class
      Parameters:
      plugin - The plugin that owns this tool
  • Method Details

    • getToolJSON

      public final String getToolJSON()
      The core uses this method when generating the list of available functions to the LLM
      Returns:
      a string formated JSON containing the representation of the tool definitions
    • name

      @NotNull public abstract @NotNull String name()

      Name of the tool.

      Returns:
      returns the name of this tool
    • description

      public String description()
      Description for the LLM on what this tool does
      Returns:
      Short description defining the scope of this tool
    • parameters

      @NotNull public abstract @NotNull ToolParameters parameters()
      The parameters this tool allows
      Returns:
      A ToolParameters object defining what this tool expects when being called
    • callTool

      public abstract ToolResponse callTool(ToolArguments arguments) throws ToolRuntimeException
      This is the main course of the tool. The LLM will call this on request of using your tool
      Parameters:
      arguments - A collective of your ToolParameters from parameters()
      Returns:
      The expected results, or ToolResponse.empty(Tool) if this is a "void" function
      Throws:
      ToolRuntimeException - This indicates that an Exception is not fatal, any other exceptions thrown from this tool will be treated as fatal, and will result in this tool, or it's plugin being disabled