File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -118,7 +118,6 @@ handle_message_from_server <- function(msg) {
118118 )
119119
120120 # cat(paste(capture.output(str(body)), collapse="\n"), file=stderr())
121-
122121 } else {
123122 body <- jsonrpc_response(
124123 data $ id ,
@@ -136,6 +135,12 @@ handle_message_from_server <- function(msg) {
136135}
137136
138137as_tool_call_result <- function (data , result ) {
138+ is_error <- FALSE
139+ if (inherits(result , " btw::BtwToolResult" )) {
140+ is_error <- ! is.null(result @ error )
141+ result <- result @ value %|| % result @ error
142+ }
143+
139144 jsonrpc_response(
140145 data $ id ,
141146 list (
@@ -145,7 +150,7 @@ as_tool_call_result <- function(data, result) {
145150 text = paste(result , collapse = " \n " )
146151 )
147152 ),
148- isError = FALSE
153+ isError = is_error
149154 )
150155 )
151156}
You can’t perform that action at this time.
0 commit comments