Skip to content

Commit b460a48

Browse files
authored
surface error from mcp tool calls (#444)
1 parent d72e843 commit b460a48

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

pkg/agent/conversation.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,7 @@ func (c *Agent) Run(ctx context.Context, initialQuery string) error {
377377
c.setAgentState(api.AgentStateDone)
378378
c.pendingFunctionCalls = []ToolCallAnalysis{}
379379
c.session.LastModified = time.Now()
380+
c.addMessage(api.MessageSourceAgent, api.MessageTypeError, "Error: "+err.Error())
380381
// In RunOnce mode, exit on tool execution error
381382
if c.RunOnce {
382383
c.setAgentState(api.AgentStateExited)
@@ -666,8 +667,10 @@ func (c *Agent) DispatchToolCalls(ctx context.Context) error {
666667
Kubeconfig: c.Kubeconfig,
667668
WorkDir: c.workDir,
668669
})
670+
669671
if err != nil {
670672
log.Error(err, "error executing action", "output", output)
673+
c.addMessage(api.MessageSourceAgent, api.MessageTypeToolCallResponse, err.Error())
671674
return err
672675
}
673676

0 commit comments

Comments
 (0)