Package com.github.copilot.sdk.json
Class ToolResultObject
java.lang.Object
com.github.copilot.sdk.json.ToolResultObject
Result object returned from a tool execution.
This class represents the structured result of a tool invocation, including text output, binary data, error information, and telemetry.
Example: Success Result
return new ToolResultObject().setResultType("success").setTextResultForLlm("File contents: " + content);
Example: Error Result
return new ToolResultObject().setResultType("error").setError("File not found: " + path);
- Since:
- 1.0.0
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets the binary results to be sent to the LLM.getError()Gets the error message.Gets the result type.Gets the session log entry.Gets the text result to be sent to the LLM.Gets the tool telemetry data.setBinaryResultsForLlm(List<ToolBinaryResult> binaryResultsForLlm) Sets binary results (images, files) to be sent to the LLM.Sets an error message for failed tool execution.setResultType(String resultType) Sets the result type.setSessionLog(String sessionLog) Sets a log entry to be recorded in the session.setTextResultForLlm(String textResultForLlm) Sets the text result to be sent to the LLM.setToolTelemetry(Map<String, Object> toolTelemetry)
-
Constructor Details
-
ToolResultObject
public ToolResultObject()
-
-
Method Details
-
getTextResultForLlm
Gets the text result to be sent to the LLM.- Returns:
- the text result
-
setTextResultForLlm
Sets the text result to be sent to the LLM.- Parameters:
textResultForLlm- the text result- Returns:
- this result for method chaining
-
getBinaryResultsForLlm
Gets the binary results to be sent to the LLM.- Returns:
- the list of binary results
-
setBinaryResultsForLlm
Sets binary results (images, files) to be sent to the LLM.- Parameters:
binaryResultsForLlm- the list of binary results- Returns:
- this result for method chaining
-
getResultType
Gets the result type.- Returns:
- the result type ("success" or "error")
-
setResultType
Sets the result type.- Parameters:
resultType- "success" or "error"- Returns:
- this result for method chaining
-
getError
Gets the error message.- Returns:
- the error message, or
nullif successful
-
setError
Sets an error message for failed tool execution.- Parameters:
error- the error message- Returns:
- this result for method chaining
-
getSessionLog
Gets the session log entry.- Returns:
- the session log text
-
setSessionLog
Sets a log entry to be recorded in the session.- Parameters:
sessionLog- the log entry- Returns:
- this result for method chaining
-
getToolTelemetry
Gets the tool telemetry data.- Returns:
- the telemetry map
-
setToolTelemetry
-