opencode icon indicating copy to clipboard operation
opencode copied to clipboard

feat: Add websearch tool with Perplexity AI integration

Open chindris-mihai-alexandru opened this issue 2 months ago • 1 comments

Summary

  • Adds websearch tool powered by Perplexity AI for real-time web search
  • Uses llama-3.1-sonar-small-128k-online model for precise, concise answers
  • Requires PERPLEXITY_API_KEY in ~/.local/share/opencode/auth.json
  • Follows OpenCode coding standards (Bun APIs, no try/catch, optional chaining)

Changes

  • packages/opencode/src/tool/websearch.ts: New tool implementation using Bun.file() API
  • packages/opencode/src/tool/websearch.txt: Tool documentation

Testing

Tool has been manually tested with custom Perplexity API key.

I can vouch for this feature, been rolling my own mini mcp server and name it 'pplx'. "hey go consult pplx about this topic before doing that", "research latest api spec for this api and save it as an md file using pplx" opened a whole new way to tackle problems.

More references

zenyr avatar Nov 02 '25 07:11 zenyr