From 8ddd74655fbe5be416ae0f31547254ef34edec81 Mon Sep 17 00:00:00 2001 From: JexLau Date: Wed, 18 Feb 2026 06:22:47 +0800 Subject: [PATCH] fix: include extracted text in web_fetch ForLLM response The ForLLM field only returned a metadata summary ("Fetched N bytes from URL"), causing the LLM to never see the actual page content. This led to repeated tool calls on the same URL until max_tool_iterations was hit. Fixes #388 Co-Authored-By: Claude Opus 4.6 --- pkg/tools/web.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/tools/web.go b/pkg/tools/web.go index 6a6d40ecf..90ff3a729 100644 --- a/pkg/tools/web.go +++ b/pkg/tools/web.go @@ -476,8 +476,10 @@ func (t *WebFetchTool) Execute(ctx context.Context, args map[string]interface{}) resultJSON, _ := json.MarshalIndent(result, "", " ") + forLLM := fmt.Sprintf("Fetched %d bytes from %s (extractor: %s, truncated: %v)\n\n%s", len(text), urlStr, extractor, truncated, text) + return &ToolResult{ - ForLLM: fmt.Sprintf("Fetched %d bytes from %s (extractor: %s, truncated: %v)", len(text), urlStr, extractor, truncated), + ForLLM: forLLM, ForUser: string(resultJSON), } }