Skip to content

feat: migrate web-search to support Tavily alongside Brave Search#2

Open
tavily-integrations wants to merge 3 commits intosonpiaz:mainfrom
Tavily-FDE:feat/tavily-migration/web-search-tavily
Open

feat: migrate web-search to support Tavily alongside Brave Search#2
tavily-integrations wants to merge 3 commits intosonpiaz:mainfrom
Tavily-FDE:feat/tavily-migration/web-search-tavily

Conversation

@tavily-integrations
Copy link
Copy Markdown

Summary

  • Added Tavily as a configurable, parallel search provider in the web_search MCP tool
  • Provider is selectable via SEARCH_PROVIDER env var (brave default, tavily option)
  • Each provider falls back to the other on failure when both API keys are configured
  • Tavily results are normalized to the same output shape (title, url, description) as Brave

Files changed

  • tools/web-search/index.ts — Refactored into searchBrave() and searchTavily() functions with shared SearchResult interface, provider routing via SEARCH_PROVIDER env var, and mutual fallback logic
  • .env.example — Added TAVILY_API_KEY and SEARCH_PROVIDER documentation
  • package.json — Added @tavily/core dependency

Dependency changes

  • Added @tavily/core ^0.6.0 to package.json

Environment variable changes

  • Added TAVILY_API_KEY — Tavily API key (required when using Tavily provider)
  • Added SEARCH_PROVIDER — Optional; 'brave' (default) or 'tavily'

Notes for reviewers

  • Existing Brave Search logic is preserved and remains the default provider
  • The MCP tool schema and output format are unchanged — this is fully backward compatible
  • Tavily r.content field is mapped to description to match the existing output shape

🤖 Generated with Claude Code

Automated Review

  • Passed after 3 attempt(s)
  • Final review: The implementation is correct and well-structured. Tavily is integrated as a configurable and fallback search provider via the SEARCH_PROVIDER env var. The SDK is used correctly (tavily({ apiKey }), client.search(), mapping r.contentdescription). The envVars fix correctly removes TAVILY_API_KEY from startup checks, preventing the tool from being skipped for existing Brave-only users. Fallback logic in both directions (Tavily→Brave and Brave→Tavily) is sound. Two minor issues are noted but do not block approval.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant