feat(web-search): remove built-in web_search tool, replace with MCP-based approach#3502
Conversation
- Add GlmProvider class implementing BaseWebSearchProvider using the ZhipuAI Web Search API (https://open.bigmodel.cn/api/paas/v4/web_search) - Support multiple search engines: search_std, search_pro, search_pro_sogou, search_pro_quark - Support optional config: maxResults, searchIntent, searchRecencyFilter, contentSize, searchDomainFilter - Truncate query to 70 characters per API limit - Register 'glm' in the provider discriminated union (types.ts) and createProvider() switch (index.ts) - Add GlmProviderConfig to settingsSchema, ConfigParams, and Config class - Add --glm-api-key CLI flag and GLM_API_KEY env var support in webSearch.ts - Forward GLM_API_KEY in sandbox environment - Update provider priority list: Tavily > Google > GLM > DashScope - Add 17 unit tests for GlmProvider and 4 integration tests in index.test.ts - Update docs/developers/tools/web-search.md with GLM configuration, env vars, CLI args, pricing, and corrected DashScope billing info - Fix stale OAuth/free-tier references in web-search.md Closes QwenLM#3496
wenshao
left a comment
There was a problem hiding this comment.
No issues found. LGTM! ✅ — gpt-5.4 via Qwen Code /review
|
感谢提交!在本地做了完整的验证,结果如下。 ✅ 验证通过
🔧 合入前建议修改的点1. 文档错误(必改)— `docs/developers/tools/web-search.md:54`新增的这句话与实现不符:
实际上 `DashScopeProvider.isAvailable()` 只判断 `authType === 'qwen-oauth'`,完全不读 `DASHSCOPE_API_KEY` 这个环境变量。用户按这句指示只设 `DASHSCOPE_API_KEY` 而没有 qwen-oauth 凭据,web search 仍然用不了,会产生误导。 建议二选一:
2. 文档补充 GLM API 的服务端限制(建议改)我实测发现 BigModel 服务端对几个参数并非硬约束,建议在 GLM 章节加一段注记,避免用户按配置的数字产生预期落差:
这些是 BigModel API 当前的行为,不是 PR 的 bug,但文档点明后用户心里有数。 3. PR 描述的数字对齐(建议改)PR body 里写 "17 unit tests",而 `glm-provider.test.ts` 里实际是 13 个;另外 `index.test.ts` 新增了 4 个 GLM 用例。建议改成 "13 unit tests for `GlmProvider` + 4 integration tests in `index.test.ts`",按文件归属更清晰。 核心代码没问题,把以上 3 点处理掉(尤其是第 1 点)就可以合并。 |
…remove qwen-oauth dependency - DashScopeProvider.isAvailable() now checks config.apiKey instead of authType - Remove OAuth credential file reading and resource_url requirement - Use standard DashScope endpoint: dashscope.aliyuncs.com/api/v1/indices/plugin/web_search - Read DASHSCOPE_API_KEY env var and --dashscope-api-key CLI flag - Forward DASHSCOPE_API_KEY into sandbox environment - Update integration test to detect DASHSCOPE_API_KEY - Update docs to reflect new API key based configuration
The web_search tool and all related provider implementations are removed. Web search functionality will be provided via MCP integrations instead, which is the direction the broader agent ecosystem is moving. Removed: - packages/core/src/tools/web-search/ (entire directory) - packages/cli/src/config/webSearch.ts - integration-tests/cli/web_search.test.ts - ToolNames.WEB_SEARCH, ToolErrorCode.WEB_SEARCH_FAILED - webSearch config in ConfigParams, Config class, settingsSchema - CLI options: --tavily-api-key, --google-api-key, --google-search-engine-id, --glm-api-key, --dashscope-api-key, --web-search-default - Sandbox env forwarding for TAVILY/GLM/DASHSCOPE/GOOGLE search keys - web_search from rule-parser, permission-manager, speculation gate, microcompact tool set, and builtin-agents tool list
wenshao
left a comment
There was a problem hiding this comment.
[Suggestion] packages/core/src/skills/bundled/qc-helper/SKILL.md:121 still lists webSearch under advanced config keys after this PR removes the webSearch setting. Users asking qc-helper about configuration can still be guided toward a removed setting instead of MCP server configuration. Please remove webSearch from the quick reference and, if useful, point web search questions to MCP server configuration instead.
[Suggestion] docs/developers/roadmap.md:59 still lists Tool: WebSearch as an implemented built-in tool using Tavily API even though this PR removes the built-in implementation. Please update the entry to reflect MCP-based web search, or mark the old built-in WebSearch item as removed/deprecated.
— gpt-5.5 via Qwen Code /review
…ased approach (QwenLM#3502) * feat(web-search): add GLM (ZhipuAI) web search provider - Add GlmProvider class implementing BaseWebSearchProvider using the ZhipuAI Web Search API (https://open.bigmodel.cn/api/paas/v4/web_search) - Support multiple search engines: search_std, search_pro, search_pro_sogou, search_pro_quark - Support optional config: maxResults, searchIntent, searchRecencyFilter, contentSize, searchDomainFilter - Truncate query to 70 characters per API limit - Register 'glm' in the provider discriminated union (types.ts) and createProvider() switch (index.ts) - Add GlmProviderConfig to settingsSchema, ConfigParams, and Config class - Add --glm-api-key CLI flag and GLM_API_KEY env var support in webSearch.ts - Forward GLM_API_KEY in sandbox environment - Update provider priority list: Tavily > Google > GLM > DashScope - Add 17 unit tests for GlmProvider and 4 integration tests in index.test.ts - Update docs/developers/tools/web-search.md with GLM configuration, env vars, CLI args, pricing, and corrected DashScope billing info - Fix stale OAuth/free-tier references in web-search.md Closes QwenLM#3496 * docs(web-search): fix DashScope note and add GLM server-side limitations * fix(web-search): make DashScope provider work with standard API key, remove qwen-oauth dependency - DashScopeProvider.isAvailable() now checks config.apiKey instead of authType - Remove OAuth credential file reading and resource_url requirement - Use standard DashScope endpoint: dashscope.aliyuncs.com/api/v1/indices/plugin/web_search - Read DASHSCOPE_API_KEY env var and --dashscope-api-key CLI flag - Forward DASHSCOPE_API_KEY into sandbox environment - Update integration test to detect DASHSCOPE_API_KEY - Update docs to reflect new API key based configuration * feat(web-search): remove built-in web search tool The web_search tool and all related provider implementations are removed. Web search functionality will be provided via MCP integrations instead, which is the direction the broader agent ecosystem is moving. Removed: - packages/core/src/tools/web-search/ (entire directory) - packages/cli/src/config/webSearch.ts - integration-tests/cli/web_search.test.ts - ToolNames.WEB_SEARCH, ToolErrorCode.WEB_SEARCH_FAILED - webSearch config in ConfigParams, Config class, settingsSchema - CLI options: --tavily-api-key, --google-api-key, --google-search-engine-id, --glm-api-key, --dashscope-api-key, --web-search-default - Sandbox env forwarding for TAVILY/GLM/DASHSCOPE/GOOGLE search keys - web_search from rule-parser, permission-manager, speculation gate, microcompact tool set, and builtin-agents tool list * fix: remove websearch reference * docs: remove websearch tool * docs: add break change guide * fix review



TLDR
Remove the entire built-in
web_searchtool and its provider infrastructure (DashScope, Tavily, Google, GLM), and replace with an MCP-based approach. Web search is now provided by connecting to external MCP servers, giving users full flexibility to choose their preferred search service.This resolves a fundamental design issue: the built-in tool required maintaining provider-specific integrations and API key plumbing for each search service, while MCP already provides a cleaner, more extensible mechanism for exactly this kind of external capability.
What Changed
Removed (~1,700 lines deleted):
packages/core/src/tools/web-search/— entire directory (tool logic, 4 providers, tests)packages/cli/src/config/webSearch.ts— provider resolution and CLI arg wiringwebSearchconfig schema,--*-api-keyCLI flags, and env var forwarding for search providersintegration-tests/cli/web_search.test.tsUpdated docs:
docs/developers/tools/web-search.md— rewritten to document MCP-based web search setup (Alibaba Cloud Bailian, Tavily, GLM WebSearch Prime)docs/developers/tools/introduction.md— moved web search from built-in tools list to MCP sectiondocs/developers/roadmap.md— updated WebSearch entry to reflect MCP approachdocs/users/configuration/settings.md— removedadvanced.tavilyApiKey,TAVILY_API_KEYenv var,--tavily-api-keyCLI flagRecommended MCP Web Search Services
https://dashscope.aliyuncs.com/api/v1/mcps/WebSearch/mcpDASHSCOPE_API_KEYhttps://mcp.tavily.com/mcp/?tavilyApiKey=<key>https://open.bigmodel.cn/api/mcp/web_search_prime/mcpGLM_API_KEYQuick setup (Tavily example):
qwen mcp add tavily -t http "https://mcp.tavily.com/mcp/?tavilyApiKey=${TAVILY_API_KEY}"Or via
settings.json:{ "mcpServers": { "tavily": { "httpUrl": "https://mcp.tavily.com/mcp/?tavilyApiKey=${TAVILY_API_KEY}" } } }Testing Matrix
Linked issues / bugs
Closes #3496