Repository navigation
Conversation
MCP search endpoints report tool failures, such as an exhausted keyless quota, as a 200 response with isError. WebSearchMcp.call ignored the flag, so the provider's message was lost and the search reported "No search results found". Fail with the provider's message instead, and show it in the websearch tool error. Refs anomalyco#54311 Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
The fix looks correct. An MCP response that reports isError now fails the search with the provider's message instead of returning an empty result.
I ran the new tests against the base: all 5 fail there, because each of the four MCP providers turns the error into an empty search and the tool test needs the new error type. With this change they pass, along with the other websearch tests in packages/core (60 in total), and tsc -b for packages/core passes. I couldn't trigger a real error response live, because keyless Firecrawl currently returns results. The #54311 reproduction for random behaves the same with and without the change, as the description says.
Reading the error flag first doesn't change how successful or undecodable responses are handled, and it reads streamed (data:) responses the same way as before.
Public API: unchanged. WebSearchMcp.ToolError is internal to packages/core, and only the tool's error message text changes.
No blocking concerns.
Related: #50217
Issue for this PR
Closes #54311 (the empty-results part; see below for what this leaves open)
This reopens #56700 rebased on current
dev. #56700 was closed as a duplicate of #50938, but #50938 was closed by the automated cleanup on 2026-10-23 without being merged. So the bug is still ondev, and users are still hitting it on 2.1.4 (see the latest comments on #54311).Type of change
What does this PR do?
MCP search endpoints report tool failures as a 200 response whose result has
isError: true. Firecrawl and Exa do this when keyless access is unavailable or their free quota runs out. The Firecrawl team confirmed this on #56700:firecrawl_searchwithout an API key currently returns HTTP 200 with "Anonymous keyless access is unavailable for this request".WebSearchMcp.callignored the flag. The adapter couldn't decode the message as results and returned[], so the tool said "No search results found. Please try a different query." and the model had no idea why.WebSearchMcp.callnow fails with aWebSearchMcp.ToolErrorthat carries the provider's text whenisErroris set. This covers every MCP-based provider (Exa, Parallel, Firecrawl, TinyFish). The websearch tool shows it asWeb search failed: <provider message>. Valid responses are unchanged.Not included: with
websearch.provider: "random", opencode still only switches providers on HTTP 429, so this error doesn't rotate to another provider. Rotating on it would change retry behavior, and I'm happy to follow up if you want that. The keyless-docs part of #54311 is also not covered here.How did you verify your code works?
test/plugin/websearch.test.ts: for each MCP provider, a 200 response withisError: truenow fails withToolErrorand the provider's message. These fail ondev, where the query succeeds with no results.test/tool-websearch.test.ts: the tool error message isWeb search failed: <provider message>. It fails without the tool change.dev: all websearch tests inpackages/core(60) andbun typecheckinpackages/corepass.Screenshots / recordings
N/A
Checklist
🤖 Generated with Claude Code
Added by the opencode bot (AI-generated).
Related: #50217