#22989: feat(web-search): add Google Custom Search Engine provider
agents
size: S
Cluster:
Web Search Provider Integrations
## Summary
Add Google Custom Search Engine (CSE) as a new web search provider option alongside brave, perplexity, and grok.
## Changes
- Added `google` to `SEARCH_PROVIDERS` array
- Added `GoogleConfig`, `GoogleSearchItem`, `GoogleSearchResponse` types
- Added config resolvers: `resolveGoogleConfig`, `resolveGoogleApiKey`, `resolveGoogleSearchEngineId`
- Added `runGoogleSearch` function using Google Custom Search API
- Updated `createWebSearchTool` with Google-specific description and error handling
- Updated config types to support `tools.web.search.google.apiKey` and `tools.web.search.google.searchEngineId`
## Configuration
Users can configure the Google provider via:
1. **Config file:**
```yaml
tools:
web:
search:
provider: google
google:
apiKey: YOUR_API_KEY
searchEngineId: YOUR_SEARCH_ENGINE_ID
```
2. **Environment variables:**
- `GOOGLE_API_KEY` - Google API key
- `GOOGLE_SEARCH_ENGINE_ID` - Custom Search Engine ID (cx parameter)
## Usage
Once configured, the web_search tool will use Google CSE:
```
web_search({ query: "hello world", count: 5 })
```
Returns results with `title`, `url`, and `description` fields.
## Requirements
Users need:
- A Google Cloud project with Custom Search API enabled
- An API key from Google Cloud Console
- A Programmable Search Engine (https://programmablesearchengine.google.com/) with its ID
## Testing
- Build passes successfully
- Follows the same patterns as existing providers (brave, perplexity, grok)
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Added Google Custom Search Engine as a new web search provider option. The implementation follows the established patterns from existing providers (brave, perplexity, grok) and includes proper type definitions, config resolvers, error handling, and external content wrapping for security. The Google provider returns structured results with titles, URLs, and snippets similar to Brave Search.
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with minimal risk
- The implementation is clean, follows established patterns from existing providers, includes proper error handling and security measures (wrapWebContent), and is well-typed. No logical errors or security vulnerabilities were found.
- No files require special attention
<sub>Last reviewed commit: c96c813</sub>
<!-- greptile_other_comments_section -->
<sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#22626: feat(search): add support for SearXNG as a search provider
by sarveshgandhi · 2026-02-21
79.6%
#16895: feat(web-search): add SearXNG as a search provider
by rustyorb · 2026-02-15
79.4%
#13665: feat(web-search): add SearXNG as a search provider
by sfo2001 · 2026-02-10
78.7%
#13075: [Feature]: Add Gemini (Google Search grounding) as web_search provider
by akoscz · 2026-02-10
76.6%
#19876: feat(web-search): add SerpAPI search provider support
by nksolar-tianjin · 2026-02-18
76.1%
#7738: feat(web-search): add provider fallback and Serper support
by garnetlyx · 2026-02-03
75.6%
#13814: feat(web-search): add ZAI Search (zsearch) provider
by strelov1 · 2026-02-11
75.5%
#11444: Add extensible search providers for web_search
by dhc02 · 2026-02-07
75.4%
#14445: feat: add SerpApi search provider plugin with vertical search support
by xiaoyaner0201 · 2026-02-12
75.0%
#17632: feat(web-search): add per-call provider override
by cog-bernthiddema · 2026-02-16
74.3%