Summary
web_search can return provider validation errors for otherwise valid searches when Brave or Kagi returns a response shape containing missing/undefined result fields.
This looks like a genuine adapter/schema robustness issue rather than caller misuse: the tool calls used valid provider, query, limit, and large_result_mode arguments. Similar Brave calls succeeded in the same session, but some queries failed during response parsing.
Repro examples
These calls failed:
{
"provider": "brave",
"query": "\"pi-prompt-shelf\" pi extension prompt",
"limit": 10,
"large_result_mode": "inline"
}
Error:
Malformed brave response: × Invalid key: Expected "web" but received undefined
→ at web
Another Brave query with the same shape also failed:
{
"provider": "brave",
"query": "\"prompt templates with model skill thinking frontmatter\" pi",
"limit": 10,
"large_result_mode": "inline"
}
Same error:
Malformed brave response: × Invalid key: Expected "web" but received undefined
→ at web
Kagi also failed for valid searches:
{
"provider": "kagi",
"query": "\"pi-prompt-shelf\" \"pi-packs\"",
"limit": 10,
"large_result_mode": "inline"
}
Error:
Malformed kagi response: × Invalid key: Expected "title" but received undefined
→ at data.2.title
× Invalid key: Expected "url" but received undefined
→ at data.2.url
× Invalid key: Expected "snippet" but received undefined
→ at data.2.snippet
× Invalid key: Expected "total_hits" but received undefined
→ at meta.total_hits
Other Kagi queries failed similarly, but at different data indexes, e.g. data.5 and data.14.
Expected behavior
The provider adapters should tolerate provider responses that contain no web block, non-result rows, omitted snippets, or missing total_hits metadata. Ideally:
- return an empty result list for no-result Brave responses instead of throwing
- filter/skip Kagi entries without
title/url
- make
snippet and meta.total_hits optional if the upstream provider omits them
- include raw provider response details in debug logs, if available, to aid diagnosis
Context
This came up while researching Pi extensions. Some Brave searches succeeded immediately before these failures, so the issue appears response-shape-specific rather than a broken MCP invocation or unavailable provider.
Summary
web_searchcan return provider validation errors for otherwise valid searches when Brave or Kagi returns a response shape containing missing/undefined result fields.This looks like a genuine adapter/schema robustness issue rather than caller misuse: the tool calls used valid
provider,query,limit, andlarge_result_modearguments. Similar Brave calls succeeded in the same session, but some queries failed during response parsing.Repro examples
These calls failed:
{ "provider": "brave", "query": "\"pi-prompt-shelf\" pi extension prompt", "limit": 10, "large_result_mode": "inline" }Error:
Another Brave query with the same shape also failed:
{ "provider": "brave", "query": "\"prompt templates with model skill thinking frontmatter\" pi", "limit": 10, "large_result_mode": "inline" }Same error:
Kagi also failed for valid searches:
{ "provider": "kagi", "query": "\"pi-prompt-shelf\" \"pi-packs\"", "limit": 10, "large_result_mode": "inline" }Error:
Other Kagi queries failed similarly, but at different data indexes, e.g.
data.5anddata.14.Expected behavior
The provider adapters should tolerate provider responses that contain no
webblock, non-result rows, omitted snippets, or missingtotal_hitsmetadata. Ideally:title/urlsnippetandmeta.total_hitsoptional if the upstream provider omits themContext
This came up while researching Pi extensions. Some Brave searches succeeded immediately before these failures, so the issue appears response-shape-specific rather than a broken MCP invocation or unavailable provider.