You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Web search fails when an MCP server sends a notification before the response #61887
WebSearchMcp.parseResponse() decodes every SSE data: field as { result } and fails on the first one that isn't. The MCP Streamable HTTP transport lets a server send JSON-RPC notifications and requests before the response ("The server MAY send JSON-RPC requests and notifications before sending a JSON-RPC response", 2025-03-26 transports), so a logging or progress notification ahead of the result makes the whole web search fail with Missing key at ["result"].
None of the bundled providers send these today (Exa and Firecrawl reply with a single SSE event, Parallel and TinyFish with plain JSON), so this doesn't affect current users. It does block any MCP search server that uses logging or progress notifications.
Disclosure: I work at You.com. We found this while looking at adding You.com as a web search provider. Our MCP server sends a logging notification before each search result.
Observed: fails with Missing key at ["result"]. Expected: { content: [{ text: "search result" }] }. Removing the notification event makes the same payload succeed.
Thanks for the clear report. I reproduced this on the latest dev (e38c009) by calling WebSearchMcp.parseResponse directly. With only the result event, it returns {"content":[{"text":"search result"}]}. With a notifications/message event before the same result, it fails with Missing key at ["result"]. The script below shows both cases.
// Copy into packages/core of an opencode checkout (after bun install) and run: bun ./repro.tsimport{Effect,Schema}from"effect"import{WebSearchMcp}from"@opencode/core/plugin/websearch/mcp"constoutput=Schema.Struct({content: Schema.Array(Schema.Struct({text: Schema.String}))})constresult='event: message\ndata: {"jsonrpc":"2.0","id":1,"result":{"content":[{"text":"search result"}]}}\n\n'constnotification='event: message\ndata: {"jsonrpc":"2.0","method":"notifications/message","params":{"level":"info","data":"Searching"}}\n\n'for(const[name,body]of[["result only",result],["notification then result",notification+result],]asconst){constexit=awaitEffect.runPromiseExit(WebSearchMcp.parseResponse(body,output))console.log(name,"=>",exit._tag==="Success" ? JSON.stringify(exit.value) : String(exit.cause))}
Activity
opencodejr commentedon Nov 5, 2026
Thanks for the clear report. I reproduced this on the latest
dev(e38c009) by callingWebSearchMcp.parseResponsedirectly. With only the result event, it returns{"content":[{"text":"search result"}]}. With anotifications/messageevent before the same result, it fails withMissing key at ["result"]. The script below shows both cases.Related:
data:without a space, multi-line data). The open PR doesn't appear to skip non-response messages, so it probably doesn't fix this on its own.Reproduction script (repro.ts)
Run it:
bun repro.ts