What would you like to be added?
The web_fetch tool should send an Accept: text/markdown, */* HTTP header when fetching URLs in fallback mode.
Why is this needed?
Currently, the WebFetch fallback fetches URLs without content negotiation. This means servers that can provide markdown default to HTML, which we then convert to text using html-to-text. This conversion loses formatting, code blocks, and structure.
By adding Accept: text/markdown, */*, servers that support markdown will return native markdown directly, providing:
- Better quality content (no lossy HTML-to-text conversion)
- Preserved formatting, code blocks, and structure
- Cleaner context for the LLM
Servers without markdown support will continue returning HTML as before (fully backward compatible).
Additional context
- Other CLI agents like Claude Code already support this
- Only affects fallback path (not the primary Gemini API fetch)
What would you like to be added?
The
web_fetchtool should send anAccept: text/markdown, */*HTTP header when fetching URLs in fallback mode.Why is this needed?
Currently, the WebFetch fallback fetches URLs without content negotiation. This means servers that can provide markdown default to HTML, which we then convert to text using
html-to-text. This conversion loses formatting, code blocks, and structure.By adding
Accept: text/markdown, */*, servers that support markdown will return native markdown directly, providing:Servers without markdown support will continue returning HTML as before (fully backward compatible).
Additional context