#16413: feat(web-search): request and merge Brave extra_snippets
agents
size: S
Cluster:
Web Search Provider Enhancements
## Summary
- feat(web-search): request and merge Brave extra_snippets
- Split from our `v2026.2.13` patch train as a single-purpose change for easier review.
## Why
- Keep the diff focused and low-risk so it can be merged or reverted independently.
## Scope
- Branch: `feat/brave-extra-snippets-lite-en`
- Files changed: 2
- Key files:
- `src/agents/tools/web-search.ts`
- `src/agents/tools/web-tools.enabled-defaults.e2e.test.ts`
## Test Plan
- Suggested local command:
- `./node_modules/.bin/vitest run src/agents/tools/web-tools.enabled-defaults.e2e.test.ts`
- Validation status:
- [ ] CI checks pass
- [ ] Maintainer re-ran local tests
## Risk & Rollback
- Risk: low to medium; impact limited to touched module(s).
- Rollback: revert this PR commit(s) cleanly.
## Co-authorship
- Co-authored by @ciberponk and Codex (GPT-5).
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
This PR adds support for Brave Search API `extra_snippets` parameter to enhance search result descriptions with additional context.
**Changes:**
- Added `extra_snippets?: string[]` field to `BraveSearchResult` type
- Enabled `extra_snippets=true` parameter in all Brave API requests
- Merged extra snippets into result descriptions by concatenating with newlines
- Added comprehensive test coverage for the new functionality
The implementation is clean and defensive - it filters out non-string values, trims whitespace, and removes empty snippets before joining. This provides richer search results without breaking existing functionality.
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with minimal risk
- The changes are well-contained, defensive, and thoroughly tested. The implementation handles edge cases (non-string values, empty snippets), the API parameter is backward-compatible (Brave API ignores unknown params), and comprehensive tests verify both parameter passing and data merging behavior. No breaking changes or security concerns.
- No files require special attention
<sub>Last reviewed commit: c94ec5f</sub>
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#16416: feat(web-search): include Brave structured faq/discussions/infobox ...
by ciberponk · 2026-02-14
84.2%
#16417: feat(web-search): enable Brave text_decorations by default
by ciberponk · 2026-02-14
78.8%
#19314: feat: add Brave web_search baseUrl override (AI-assisted)
by mrutunjay-kinagi · 2026-02-17
75.6%
#19379: feat: increase Brave search MAX_SEARCH_COUNT to 20 (AI-assisted)
by liyishuai · 2026-02-17
72.5%
#23306: fix(web-search): hint at config validation failure in missing-key e...
by lbo728 · 2026-02-22
72.4%
#19298: feat(tools): add Brave LLM Context API mode for web_search
by RoccoFortuna · 2026-02-17
72.2%
#19042: Security: add URL allowlist for web_search and web_fetch
by smartprogrammer93 · 2026-02-17
71.8%
#19084: fix: Brave Search baseUrl and Inter-session Message Role
by jackjin1997 · 2026-02-17
71.8%
#13370: Tools: rewrite Grok parser, add Tavily provider, multi-provider con...
by a-anand-91119 · 2026-02-10
71.8%
#13843: feat(web-search): allow overriding Brave Search base URL
by strelov1 · 2026-02-11
71.7%