feat: make web search mandatory in research and plan commands#40
Merged
feat: make web search mandatory in research and plan commands#40
Conversation
Implements searchExa adapter following TDD strict workflow: - DI-based ExaClient interface for testability - Maps recency to startPublishedDate using recencyToDate() - Maps search options (type, domains, category, include_text) - Clamps num_results to max 100 via clampNumResults() - Handles null titles, empty results, cost tracking - Extracts images and combines content from results - 15 test cases covering all adapter behaviors Task: Create the Exa adapter with TDD strict (tests first)
Created Perplexity adapter for search-mcp with strict TDD workflow: - Tests cover SSE parsing, citation extraction, image extraction, error handling - Implementation uses dependency injection for testability - Supports LLM tuning params (temperature, top_p, top_k, max_tokens, etc.) - Handles timeout and error scenarios with standardized error messages Task: Create the Perplexity adapter with TDD strict (tests first)
Implements Brave Search API adapter following TDD strict workflow. Tests written first (RED), then minimal implementation (GREEN). - 10 test cases covering all specified behaviors - Dependency injection for testability - 30s timeout with AbortController - Recency to freshness mapping (day→pd, week→pw, month→pm, year→py) - Proper error handling for non-OK responses and timeouts - Result parsing: web.results → SearchResult format
- types.ts: SearchInput, SearchResult, SearchProvider, ToolOutput types - types.ts: recencyToDate(), clampNumResults(), validateProviderParams() - types.ts: PROVIDER_PARAM_MATRIX for FR-7 param validation - format.ts: formatResponse() converts SearchResult to MCP text output - package.json: add exa-js@2.4.0 dependency - 31 tests covering types and format modules
- index.ts: MCP server with search_web tool registration - Detects available providers from env vars at startup - Validates DEFAULT_PROVIDER against available providers - Static Zod enum for provider param (FR-6) - Provider-specific param validation in handler (FR-7) - Dynamic tool description listing available providers - Dispatches to correct adapter based on provider param - 15 tests covering provider detection, resolution, and description
- .mcp.json: replace perplexity entry with search entry, add env vars - web-search-researcher.md: mcp__perplexity__search_web → mcp__search__search_web - README.md: update MCP config example and directory structure
…d type safety - Add AbortController timeout (30s) and error normalization to Exa adapter (FR-8) - Replace exaClient! non-null assertion with defensive null check in index.ts - Add typed BraveWebResult/BraveSearchResponse interfaces, remove `any` casts - Fix brave.ts clampNumResults to use literal "brave" instead of input.provider - Add 3 new tests for exa timeout and error normalization (87 total passing)
Replaced by the multi-provider search-mcp which supports Perplexity, Exa, and Brave.
Instead of hardcoding "30s", derive from actual timeoutMs parameter.
Clear Exa setTimeout after Promise.race resolves to prevent timer memory leak. Remove redundant clearTimeout from Perplexity catch block (finally block handles it). Reorder default provider cascade to Exa > Brave > Perplexity based on result quality preference.
Bump version for multi-provider search MCP server, review fixes, and provider priority reordering.
The .mcp.json hardcoded DEFAULT_PROVIDER=perplexity, which defeated the ALL_PROVIDERS priority order (Exa > Brave > Perplexity) set in index.ts. Removing it lets the code cascade work as intended.
Web search was optional, triggered only when users explicitly requested it. Now web-search-researcher always spawns in parallel with codebase subagents across /research, /research-deep, and /plan. The agent uses parallel multi-tool search (mcp__search__search_web + WebSearch) instead of sequential Sonar-first flow. Graceful degradation ensures commands complete even when all search APIs are unavailable.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
mcp__search__search_web+WebSearch) instead of sequential Sonar-first flow. Added partial/total failure handling.Plan
plans/mandatory-web-search-integration.mdReview
Reviewed by GPT-5.3-Codex (xhigh) and Gemini 3 Pro in parallel. Two findings addressed:
Test plan
/research <topic>spawns web-search-researcher without explicit request/research --swarm <topic>spawns web-search-researcher alongside team/research-deep <topic>includes web findings in context.md/plan <feature>uses web search during Research Checkpointbun run validatepasses