Class ToolCallResponse

java.lang.Object
com.alibaba.cloud.ai.graph.agent.interceptor.ToolCallResponse

public class ToolCallResponse extends Object
Response object for tool calls.
  • Constructor Details

  • Method Details

    • of

      public static ToolCallResponse of(String toolCallId, String toolName, String result)
    • error

      public static ToolCallResponse error(String toolCallId, String toolName, String errorMessage)
      Creates an error response for a failed tool execution.
      Parameters:
      toolCallId - the tool call ID
      toolName - the tool name
      errorMessage - the error message
      Returns:
      a new error ToolCallResponse
    • error

      public static ToolCallResponse error(String toolCallId, String toolName, Throwable cause)
      Creates an error response for a failed tool execution from a Throwable. Preserves the exception class name when message is null.
      Parameters:
      toolCallId - the tool call ID
      toolName - the tool name
      cause - the exception that caused the failure
      Returns:
      a new error ToolCallResponse
    • builder

      public static ToolCallResponse.Builder builder()
    • getResult

      public String getResult()
    • getToolName

      public String getToolName()
    • getToolCallId

      public String getToolCallId()
    • getStatus

      public String getStatus()
    • getMetadata

      public Map<String,Object> getMetadata()
    • isError

      public boolean isError()
      Checks if this response represents an error.
      Returns:
      true if this is an error response
    • toToolResponse

      public org.springframework.ai.chat.messages.ToolResponseMessage.ToolResponse toToolResponse()