fix(web-search-advanced): make text content opt-in, default to highlights - #339
Open
malob wants to merge 1 commit into
Open
fix(web-search-advanced): make text content opt-in, default to highlights#339malob wants to merge 1 commit into
malob wants to merge 1 commit into
Conversation
…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>
|
@malob is attempting to deploy a commit to the Exa Team on Vercel. A member of the Team first needs to authorize it. |
Author
|
@kesku gentle ping. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
web_search_advanced_exatool unconditionally setcontents.text = truein every Exa search request, so every result included full page text. The only way to suppress it wastextMaxCharacters: 1, which still returned a 1-charactertextfield on each result — token-wasteful and an awkward escape hatch.web_search_exatool, which sendscontents: { highlights: true }and has no text knob.web_search_advanced_exafollows the same default asweb_search_exa— highlights only — and full text becomes an explicit opt-in via a newenableTextparameter (parallel to the existingenableSummaryandenableHighlights).Changes
enableText: booleanparameter. Off by default.text: truefrom the contents block. Text is only requested whenenableTextis set.contents.highlights = true. This matchesweb_search_exaand Exa's published guidance for agent workflows.textMaxCharactersdescription to note it requiresenableText: true— consistent with howsummaryQueryrequiresenableSummaryandhighlightsMaxCharactersrequiresenableHighlights(both siblings already silent-drop without their parent flag).ExaAdvancedSearchRequest.contents.highlightsto{...} | booleanto allowtrueas the new default. The API supports this; the siblingExaSearchRequest.contents.highlightstype already allowed it.Behavior change
This is a behavior change for existing callers of
web_search_advanced_exa:enableText: trueto restore the old behavior.web_search_advanced_exaisenabled: falsein 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.tests/unit/tools/webSearchAdvanced.test.tscovers:query) →contents: { livecrawl: "fallback", highlights: true }, notextfield.enableText: true→contents: { livecrawl: "fallback", text: true }, no implicit highlights.