diff --git a/pkg/tools/integration/web.go b/pkg/tools/integration/web.go index f8000ce9..d7a3112a 100644 --- a/pkg/tools/integration/web.go +++ b/pkg/tools/integration/web.go @@ -350,6 +350,19 @@ func (p *BraveSearchProvider) Search( results := searchResp.Web.Results if len(results) == 0 { + // Log a warning when the API returned 200 but no results. + // This helps diagnose API format changes or silent errors + // where the response body does not match the expected structure. + bodyPreview := string(body) + if len(bodyPreview) > 300 { + bodyPreview = bodyPreview[:300] + } + logger.WarnCF("web_search", "Brave API returned empty results", + map[string]any{ + "query": query, + "status": resp.StatusCode, + "body_preview": bodyPreview, + }) return fmt.Sprintf("No results for: %s", query), nil }