Skip to content

Commit 2c7c733

Browse files
fix(go): forward binary_results_for_llm and session_log in HandlePendingToolCall RPC
ToolResult.BinaryResultsForLLM and SessionLog were dropped when building ExternalToolTextResultForLlm in executeToolAndRespond, mirroring the same bug fixed in Python by this PR. Binary tool outputs (e.g. images) returned by Go tool handlers never reached the model. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent d9058f0 commit 2c7c733

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

go/session.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1575,6 +1575,20 @@ func (s *Session) executeToolAndRespond(requestID, toolName, toolCallID string,
15751575
if result.Error != "" {
15761576
rpcResult.Error = &result.Error
15771577
}
1578+
if result.SessionLog != "" {
1579+
rpcResult.SessionLog = &result.SessionLog
1580+
}
1581+
for _, b := range result.BinaryResultsForLLM {
1582+
entry := rpc.ExternalToolTextResultForLlmBinaryResultsForLlm{
1583+
Data: b.Data,
1584+
MIMEType: b.MIMEType,
1585+
Type: rpc.ExternalToolTextResultForLlmBinaryResultsForLlmType(b.Type),
1586+
}
1587+
if b.Description != "" {
1588+
entry.Description = &b.Description
1589+
}
1590+
rpcResult.BinaryResultsForLlm = append(rpcResult.BinaryResultsForLlm, entry)
1591+
}
15781592
s.RPC.Tools.HandlePendingToolCall(ctx, &rpc.HandlePendingToolCallRequest{
15791593
RequestID: requestID,
15801594
Result: rpcResult,

0 commit comments

Comments
 (0)