Class ToolExecutionUtils

java.lang.Object
ai.acolite.agentsdk.core.runner.ToolExecutionUtils

public class ToolExecutionUtils extends Object
ToolExecutionUtils

Static utility methods for tool execution and parameter handling. Extracted from Runner for better testability and reusability.

  • Method Details

    • findToolByName

      public static FunctionTool<?,?,?> findToolByName(Agent<?,?> agent, String toolName)
      Find a tool by name in the agent's tool list.
      Parameters:
      agent - Agent containing tools
      toolName - Name of the tool to find
      Returns:
      FunctionTool if found, null otherwise
    • deserializeParameters

      public static Object deserializeParameters(Object parameters, Object parameterSchema)
      Deserialize parameters from Map/JSON to the tool's input type.

      Uses Jackson with FAIL_ON_UNKNOWN_PROPERTIES=false to handle API responses that may include extra fields.

      Parameters:
      parameters - Raw parameters (typically Map from JSON)
      parameterSchema - Schema defining the parameter type (should be a Class)
      Returns:
      Deserialized parameters as the target type
      Throws:
      RuntimeException - if deserialization fails