Skip to content

feat: migrate search to support Tavily as configurable provider#2

Open
tavily-integrations wants to merge 1 commit intoVincentwei1021:masterfrom
Tavily-FDE:feat/tavily-migration/core-api-search-tavily
Open

feat: migrate search to support Tavily as configurable provider#2
tavily-integrations wants to merge 1 commit intoVincentwei1021:masterfrom
Tavily-FDE:feat/tavily-migration/core-api-search-tavily

Conversation

@tavily-integrations
Copy link
Copy Markdown

Summary

  • Added Tavily as an opt-in search provider alongside the existing DuckDuckGo provider
  • New search() dispatch function routes to Tavily when SEARCH_PROVIDER=tavily and TAVILY_API_KEY is set, otherwise falls back to DuckDuckGo
  • Updated /v1/search route, MCP SSE server, and standalone MCP server to use the provider-aware dispatch
  • DuckDuckGo remains the default — no breaking changes

Files changed

  • src/services/search.ts — Added searchTavily() and search() dispatch function
  • src/routes/search.ts — Switched from searchDuckDuckGo to search dispatch
  • src/mcp-sse.ts — Switched to search dispatch, updated tool description
  • src/mcp-server.ts — Switched to search dispatch, updated tool description
  • package.json — Added @tavily/core dependency
  • .env.example — Documented SEARCH_PROVIDER and TAVILY_API_KEY

Dependency changes

  • Added @tavily/core ^0.6.4 (npm)

Environment variable changes

  • SEARCH_PROVIDER (optional, default: duckduckgo, values: duckduckgo | tavily)
  • TAVILY_API_KEY (required when SEARCH_PROVIDER=tavily)

Notes for reviewers

  • The Tavily SDK uses content field where DuckDuckGo uses snippet — the mapping is handled in searchTavily()
  • TypeScript compiles with zero errors
  • No changes to the response contract — SearchResult interface is unchanged

🤖 Generated with Claude Code

Automated Review

  • Passed after 1 attempt(s)
  • Final review: The Tavily migration is correct and complete. All 7 files listed in the plan are updated: the dispatch function in src/services/search.ts correctly routes to Tavily when configured and falls back to DuckDuckGo otherwise, all callers (route handler, mcp-sse, mcp-server) are updated to use the new search export, @tavily/core is properly added as a dependency, and env vars are documented in .env.example. The Tavily SDK usage (tavily() client + client.search()) is correct. Three minor issues exist but none 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