Interface ToolCallback

All Superinterfaces:
FunctionCallback
All Known Implementing Classes:
AsyncMcpToolCallback, FunctionToolCallback, MethodToolCallback, SyncMcpToolCallback

public interface ToolCallback extends FunctionCallback
Represents a tool whose execution can be triggered by an AI model.
Since:
1.0.0
Author:
Thomas Vitale
  • Method Details

    • getToolDefinition

      ToolDefinition getToolDefinition()
      Definition used by the AI model to determine when and how to call the tool.
    • getToolMetadata

      default ToolMetadata getToolMetadata()
      Metadata providing additional information on how to handle the tool.
    • call

      String call(String toolInput)
      Execute tool with the given input and return the result to send back to the AI model.
      Specified by:
      call in interface FunctionCallback
      Parameters:
      toolInput - JSON string with the function arguments to be passed to the function. The arguments are defined as JSON schema usually registered with the model.
      Returns:
      String containing the function call response.
    • call

      default String call(String toolInput, @Nullable ToolContext tooContext)
      Execute tool with the given input and context, and return the result to send back to the AI model.
      Specified by:
      call in interface FunctionCallback
      Parameters:
      toolInput - JSON string with the function arguments to be passed to the function. The arguments are defined as JSON schema usually registered with the model. Arguments are provided by the AI model.
      Returns:
      String containing the function call response.
    • getName

      @Deprecated default String getName()
      Deprecated.
      Specified by:
      getName in interface FunctionCallback
      Returns:
      Returns the Function name. Unique within the model.
    • getDescription

      @Deprecated default String getDescription()
      Deprecated.
      Specified by:
      getDescription in interface FunctionCallback
      Returns:
      Returns the function description. This description is used by the model do decide if the function should be called or not.
    • getInputTypeSchema

      @Deprecated default String getInputTypeSchema()
      Deprecated.
      Specified by:
      getInputTypeSchema in interface FunctionCallback
      Returns:
      Returns the JSON schema of the function input type.