Class ToolNode


public class ToolNode extends AbstractContextNode<AbstractTool<?,?>>
A context tree node representing an AbstractTool.

This is a leaf node in the context hierarchy, representing an individual executable function. It displays the tool's declaration token count and its current permission status.

Author:
anahata
  • Constructor Details

    • ToolNode

      public ToolNode(AgiPanel agiPanel, AbstractTool<?,?> userObject)
      Constructs a new ToolNode.
      Parameters:
      agiPanel - The parent agi panel.
      userObject - The tool to wrap.
  • Method Details

    • getName

      public String getName()
      Gets the human-readable display name for this node. Returns the simple name of the tool, removing any toolkit prefix.
      Specified by:
      getName in class AbstractContextNode<AbstractTool<?,?>>
      Returns:
      The name to be displayed in the tree.
    • getDescription

      public String getDescription()
      Gets a detailed description of the node's purpose or content.
      Specified by:
      getDescription in class AbstractContextNode<AbstractTool<?,?>>
      Returns:
      The description string.
    • fetchChildObjects

      protected List<?> fetchChildObjects()
      Fetches the current list of domain objects that should be represented as children of this node.
      Specified by:
      fetchChildObjects in class AbstractContextNode<AbstractTool<?,?>>
      Returns:
      A list of domain objects.
    • createChildNode

      protected AbstractContextNode<?> createChildNode(Object obj)
      Creates a new child node for the given domain object.
      Specified by:
      createChildNode in class AbstractContextNode<AbstractTool<?,?>>
      Parameters:
      obj - The domain object to wrap.
      Returns:
      A new AbstractContextNode, or null if the object type is not supported.
    • calculateLocalTokens

      protected void calculateLocalTokens()
      Calculates the token counts for this node's own content (excluding children).
      Specified by:
      calculateLocalTokens in class AbstractContextNode<AbstractTool<?,?>>
    • isActive

      public boolean isActive()
      Checks if the underlying domain object is currently active in the context.

      Subclasses override this method to define their specific active-state policy, allowing for clean, polymorphic evaluation without dirty instanceof chains.

      Specified by:
      isActive in class AbstractContextNode<AbstractTool<?,?>>
      Returns:
      true if active, false otherwise.
    • updateStatus

      protected void updateStatus()
      Updates the status string for this node.
      Specified by:
      updateStatus in class AbstractContextNode<AbstractTool<?,?>>