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 <noreply@anthropic.com>
This commit is contained in:
parent
ba47892bcf
commit
8ddd74655f
1 changed files with 3 additions and 1 deletions
|
|
@ -476,8 +476,10 @@ func (t *WebFetchTool) Execute(ctx context.Context, args map[string]interface{})
|
||||||
|
|
||||||
resultJSON, _ := json.MarshalIndent(result, "", " ")
|
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{
|
return &ToolResult{
|
||||||
ForLLM: fmt.Sprintf("Fetched %d bytes from %s (extractor: %s, truncated: %v)", len(text), urlStr, extractor, truncated),
|
ForLLM: forLLM,
|
||||||
ForUser: string(resultJSON),
|
ForUser: string(resultJSON),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue