Skip to content

Conversation

@gary149
Copy link
Collaborator

@gary149 gary149 commented Dec 21, 2025

Summary

  • Use highlights instead of full page text to minimize context size
  • Add text fallback with 500 char limit when highlights are empty

Problem

The direct Exa API integration (added in #2021) was requesting text: true which returned entire page contents (5-20K+ characters per result). This overwhelmed the LLM context compared to the original MCP server behavior.

Solution

Changed content request from full text to:

  • highlights: 3 sentences, 2 per URL (concise, query-relevant snippets)
  • text fallback: max 500 chars (only used if highlights are empty)
Before After
~5,000-20,000+ chars per result ~300-600 chars per result
10 results = 50-200K chars 10 results = 3-6K chars

Test plan

  • Test web search with Exa to verify results still contain useful content
  • Verify LLM responses are more focused/better quality with reduced context

Use highlights instead of full page text to minimize context size.
The previous implementation requested `text: true` which returned
entire page contents (5-20K+ chars per result), overwhelming LLM context.

Now uses:
- highlights: 3 sentences, 2 per URL (concise, query-relevant)
- text fallback: max 500 chars (only if highlights empty)

This matches what the MCP server at mcp.exa.ai likely returns.
@gary149 gary149 merged commit b2bdeb4 into main Dec 21, 2025
5 of 6 checks passed
@gary149 gary149 deleted the fix/exa-reduce-context-size branch December 21, 2025 20:22
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.

2 participants