#19379: feat: increase Brave search MAX_SEARCH_COUNT to 20 (AI-assisted)
docs
agents
size: XS
Cluster:
Web Search Provider Enhancements
## Disclaimer
* Created by OpenClaw.
* Untested.
* Prompts:
> Per https://api-dashboard.search.brave.com/documentation/services/web-search#pagination
> Brave supports at most 20 results per query,
> but https://github.com/openclaw/openclaw/blob/main/src/agents/tools/web-search.ts limits `MAX_SEARCH_COUNT = 10`
> Create an issue and PR to change the max count to 20. Abide by the issue and PR templates strictly.
* I understand what the code does.
## Summary
Describe the problem and fix in 2–5 bullets:
- Problem: Brave search results are hard-capped at 10.
- Why it matters: The Brave Search API supports up to 20 results per query (see [docs](https://api-dashboard.search.brave.com/documentation/services/web-search#pagination)).
- What changed: Increased `MAX_SEARCH_COUNT` from 10 to 20 in the Brave search tool.
- What did NOT change (scope boundary): The default count remains unchanged; only the upper limit is increased.
## Change Type (select all)
- [ ] Bug fix
- [x] Feature
- [ ] Refactor
- [ ] Docs
- [ ] Security hardening
- [ ] Chore/infra
## Scope (select all touched areas)
- [ ] Gateway / orchestration
- [x] Skills / tool execution
- [ ] Auth / tokens
- [ ] Memory / storage
- [ ] Integrations
- [ ] API / contracts
- [ ] UI / DX
- [ ] CI/CD / infra
## Linked Issue/PR
- Closes #19377
- Related #
## User-visible / Behavior Changes
Agents can now request up to 20 results per search query using the `count` parameter.
## Security Impact (required)
- New permissions/capabilities? (`No`)
- Secrets/tokens handling changed? (`No`)
- New/changed network calls? (`No`)
- Command/tool execution surface changed? (`No`)
- Data access scope changed? (`No`)
## Repro + Verification
### Environment
- OS: Linux
- Runtime/container: OpenClaw Agent
- Model/provider: Brave Search
### Steps
1. Call `web_search` with `count: 20`.
2. Observe if the limit prevents requesting more than 10.
### Expected
- The tool allows requesting up to 20 results.
### Actual
- The tool was limited to 10.
## Evidence
Attach at least one:
- [x] [Brave Pagination Documentation](https://api-dashboard.search.brave.com/documentation/services/web-search#pagination)
## Human Verification (required)
What you personally verified (not just CI), and how:
- Verified scenarios: Code constant update.
- Edge cases checked: None (safe constant increase).
- What you did **not** verify: Live API response with 20 results (verified via docs).
## Compatibility / Migration
- Backward compatible? (`Yes`)
- Config/env changes? (`No`)
- Migration needed? (`No`)
## Failure Recovery (if this breaks)
- How to disable/revert this change quickly: Revert commit to set `MAX_SEARCH_COUNT` back to 10.
- Files/config to restore: `src/agents/tools/web-search.ts`
- Known bad symptoms reviewers should watch for: Unexpected search tool errors if Brave API limit changes (unlikely as 20 is documented).
## Risks and Mitigations
List only real risks for this PR. Add/remove entries as needed. If none, write `None`.
- Risk: Brave API limit could potentially decrease in the future.
- Mitigation: The tool handles API errors gracefully if the count is too high.
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Increased Brave search maximum result count from 10 to 20 to align with the Brave Search API's native pagination capacity. The change updates the `MAX_SEARCH_COUNT` constant and propagates the new limit throughout all documentation (English and Chinese), type definitions, schema descriptions, and help text. Default count remains 5; only the upper limit is raised. This is a backward-compatible enhancement that allows agents to request more search results when needed.
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with no concerns
- The change is a simple constant update from 10 to 20, fully supported by Brave's API documentation. All related documentation, type definitions, and schema descriptions have been consistently updated across English and Chinese docs. The change is backward compatible (only raises the maximum, default stays at 5) and involves no new logic or behavior changes.
- No files require special attention
<sub>Last reviewed commit: 32a58e7</sub>
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#19314: feat: add Brave web_search baseUrl override (AI-assisted)
by mrutunjay-kinagi · 2026-02-17
74.2%
#15512: fix(web-search): normalize Chinese language codes for Brave API
by brandonwise · 2026-02-13
73.4%
#19084: fix: Brave Search baseUrl and Inter-session Message Role
by jackjin1997 · 2026-02-17
72.9%
#16413: feat(web-search): request and merge Brave extra_snippets
by ciberponk · 2026-02-14
72.5%
#19042: Security: add URL allowlist for web_search and web_fetch
by smartprogrammer93 · 2026-02-17
72.2%
#16416: feat(web-search): include Brave structured faq/discussions/infobox ...
by ciberponk · 2026-02-14
71.9%
#17729: fix(configure): update web tools hint to reflect all search providers
by raktim-mondol · 2026-02-16
71.8%
#8715: fix(web-search): safer provider resolution & Perplexity auto-detection
by abhijeet117 · 2026-02-04
71.2%
#23306: fix(web-search): hint at config validation failure in missing-key e...
by lbo728 · 2026-02-22
70.3%
#13843: feat(web-search): allow overriding Brave Search base URL
by strelov1 · 2026-02-11
69.5%