docs/developers/tools/web-fetch.md
web_fetch)This document describes the web_fetch tool for Qwen Code.
Use web_fetch to fetch content from a specified URL and process it using an AI model. The tool takes a URL and a prompt as input, fetches the URL content, and processes the content with the prompt using a small, fast model.
web_fetch takes three arguments:
url (string, required): The URL to fetch content from. Must be a fully-formed valid URL starting with http:// or https://.prompt (string, required): The prompt describing what information you want to extract from the page content.format (string, optional): Controls only the Accept header sent to the server, indicating your content preference. All fetched content is normalized to plain text for LLM processing, regardless of the format specified. Defaults to "auto" if not specified.
"auto" (default): Prefers markdown via content negotiation (Accept: text/markdown, text/html), accepts HTML as fallback. Recommended for most use cases as it can reduce token usage by up to 80% for servers that support markdown."markdown": Sends Accept: text/markdown. Use when you explicitly need markdown content."html": Sends Accept: text/html. Use when the server requires HTML in the Accept header. Content is still converted to plain text for LLM processing."text": Sends Accept: text/plain. Use when you specifically need plain text content.web_fetch with Qwen CodeTo use web_fetch with Qwen Code, provide a URL and a prompt describing what you want to extract from that URL. The tool will ask for confirmation before fetching the URL. Once confirmed, the tool will fetch the content directly and process it using an AI model.
The tool automatically:
Usage:
web_fetch(url="https://example.com", prompt="Summarize the main points of this article")
With format specification:
web_fetch(url="https://example.com", prompt="Get the raw content", format="markdown")
web_fetch examplesSummarize a single article:
web_fetch(url="https://example.com/news/latest", prompt="Can you summarize the main points of this article?")
Extract specific information:
web_fetch(url="https://arxiv.org/abs/2401.0001", prompt="What are the key findings and methodology described in this paper?")
Analyze GitHub documentation:
web_fetch(url="https://github.com/QwenLM/Qwen/blob/main/README.md", prompt="What are the installation steps and main features?")
Get markdown content (for servers supporting Markdown for Agents):
web_fetch(url="https://developers.cloudflare.com/fundamentals/reference/markdown-for-agents/", prompt="Extract the key information", format="markdown")
web_fetch processes one URL at a time. To analyze multiple URLs, make separate calls to the tool.format="auto" (default), it sends Accept: text/markdown, text/html headers, allowing servers that support markdown to return it directly instead of HTML. This can reduce token usage by up to 80%.Qwen Code's web_fetch tool implements support for Cloudflare's Markdown for Agents specification. This feature allows websites to serve markdown content directly to AI agents, significantly reducing token usage compared to parsing HTML.
format parameter controls only the Accept header sent to the server (it does not affect the output format):
format="auto": sends Accept: text/markdown, text/htmlformat="markdown": sends Accept: text/markdownformat="html": sends Accept: text/htmlformat="text": sends Accept: text/plainContent-Type: text/markdown