Skip to content

fix(web-search-advanced): make text content opt-in, default to highlights - #339

Open
malob wants to merge 1 commit into
exa-labs:mainfrom
malob:fix/web-search-advanced-default-highlights
Open

fix(web-search-advanced): make text content opt-in, default to highlights#339
malob wants to merge 1 commit into
exa-labs:mainfrom
malob:fix/web-search-advanced-default-highlights

Conversation

@malob

@malob malob commented May 14, 2026

Copy link
Copy Markdown

Summary

  • The web_search_advanced_exa tool unconditionally set contents.text = true in every Exa search request, so every result included full page text. The only way to suppress it was textMaxCharacters: 1, which still returned a 1-character text field on each result — token-wasteful and an awkward escape hatch.
  • This was inconsistent with two things:
    • The sibling web_search_exa tool, which sends contents: { highlights: true } and has no text knob.
    • Exa's own Contents Best Practices guide: "Use highlights for agentic workflows: When building multi-step agents that make repeated content extraction calls, highlights provide the most relevant excerpts without flooding context windows."
  • After this change, web_search_advanced_exa follows the same default as web_search_exa — highlights only — and full text becomes an explicit opt-in via a new enableText parameter (parallel to the existing enableSummary and enableHighlights).

Changes

  • Add enableText: boolean parameter. Off by default.
  • Remove the unconditional text: true from the contents block. Text is only requested when enableText is set.
  • When no content mode is requested, default contents.highlights = true. This matches web_search_exa and Exa's published guidance for agent workflows.
  • Update the textMaxCharacters description to note it requires enableText: true — consistent with how summaryQuery requires enableSummary and highlightsMaxCharacters requires enableHighlights (both siblings already silent-drop without their parent flag).
  • Widen ExaAdvancedSearchRequest.contents.highlights to {...} | boolean to allow true as the new default. The API supports this; the sibling ExaSearchRequest.contents.highlights type already allowed it.

Behavior change

This is a behavior change for existing callers of web_search_advanced_exa:

  • Before: every search returned full page text by default.
  • After: returns highlights only by default. Set enableText: true to restore the old behavior.

web_search_advanced_exa is enabled: false in the default tool registry (src/mcp-handler.ts), so only callers who have explicitly enabled the tool are affected.

Test plan

  • npm run ci — typecheck clean, 83 tests passing.
  • New file tests/unit/tools/webSearchAdvanced.test.ts covers:
    • Default call (just query) → contents: { livecrawl: "fallback", highlights: true }, no text field.
    • enableText: truecontents: { livecrawl: "fallback", text: true }, no implicit highlights.

…ghts

The advanced web search tool unconditionally sent `text: true` in the
contents block, so every result included full page text. The only way
to suppress was `textMaxCharacters: 1`, which still returned a
1-character `text` field on every result — token-wasteful, inconsistent
with the sibling `web_search_exa` tool, and against Exa's own Contents
Best Practices, which recommends highlights as the default for agent
workflows ("Use highlights for agentic workflows... highlights provide
the most relevant excerpts without flooding context windows").

- Add `enableText` parameter, parallel to existing `enableSummary` and
  `enableHighlights` (opt-in, off by default).
- When no content mode is explicitly requested, default to
  `contents.highlights = true`, matching `web_search_exa`.
- Widen `ExaAdvancedSearchRequest.contents.highlights` to `{...} |
  boolean` to allow the new default (the API supports it; the sibling
  `ExaSearchRequest.contents.highlights` type already did).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented May 14, 2026

Copy link
Copy Markdown

@malob is attempting to deploy a commit to the Exa Team on Vercel.

A member of the Team first needs to authorize it.

@malob

malob commented Jul 26, 2026

Copy link
Copy Markdown
Author

@kesku gentle ping.

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