diff --git a/internal/tools/tts.go b/internal/tools/tts.go index d53a1452..e756de57 100644 --- a/internal/tools/tts.go +++ b/internal/tools/tts.go @@ -12,6 +12,7 @@ import ( "github.com/google/uuid" + "github.com/nextlevelbuilder/goclaw/internal/bus" "github.com/nextlevelbuilder/goclaw/internal/store" "github.com/nextlevelbuilder/goclaw/internal/tts" ) @@ -238,7 +239,16 @@ func (t *TtsTool) Execute(ctx context.Context, args map[string]any) *Result { } forLLM := fmt.Sprintf("%sMEDIA:%s", voiceTag, audioPath) - r := &Result{ForLLM: forLLM} + // Set Result.Media explicitly (matching create_audio) so the agent loop's + // media collector uses the authoritative path even when the ForLLM + // MEDIA: prefix is reshaped by a provider bridge (e.g. claude_cli MCP). + r := &Result{ + ForLLM: forLLM, + Media: []bus.MediaFile{{ + Path: audioPath, + MimeType: "audio/" + result.Extension, + }}, + } r.Deliverable = fmt.Sprintf("[Generated audio: %s]\nText: %s", filepath.Base(audioPath), text) if t.vaultIntc != nil { mimeType := "audio/" + result.Extension