Skip to content

Commit 1399379

Browse files
Copilotbrunoborges
andcommitted
Address code review feedback: improve error() method and document failure() vs error()
Co-authored-by: brunoborges <129743+brunoborges@users.noreply.github.com>
1 parent c9b4c00 commit 1399379

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/main/java/com/github/copilot/sdk/json/ToolResultObject.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public static ToolResultObject success(String textResultForLlm) {
7676
* @return an error result
7777
*/
7878
public static ToolResultObject error(String error) {
79-
return new ToolResultObject("error", "An error occurred.", null, error, null, null);
79+
return new ToolResultObject("error", null, null, error, null, null);
8080
}
8181

8282
/**
@@ -94,6 +94,10 @@ public static ToolResultObject error(String textResultForLlm, String error) {
9494

9595
/**
9696
* Creates a failure result with the given text and error message.
97+
* <p>
98+
* The "failure" result type indicates that the tool execution itself failed
99+
* (e.g., tool not found), while "error" indicates the tool executed but
100+
* encountered an error during processing.
97101
*
98102
* @param textResultForLlm
99103
* the text result to be sent to the LLM

0 commit comments

Comments
 (0)