web_fetch tool allows the Gemini agent to retrieve and process content from specific URLs provided in your prompt.
Overview
The agent automatically uses this tool when you include URLs in your prompt and request specific operations like summarization or data extraction.Parameters
A request containing up to 20 valid URLs (starting with
http:// or https://) and instructions on how to process themHow It Works
Content Retrieval
The tool uses the Gemini API’s
urlContext feature for retrieval. If API access fails, it attempts to fetch raw content directly from your local machine.Use Cases
Article Summarization
Summarize technical articles or blog posts
Data Comparison
Compare information between multiple web pages
Information Extraction
Extract specific data from documentation sites
Content Analysis
Analyze and synthesize content from web resources
Examples
Summarize an Article
- Detect the URL in your prompt
- Request confirmation to fetch the URL
- Retrieve the article content
- Generate a summary of the key points
Compare Multiple Sources
- Fetch both URLs
- Analyze the content from each source
- Identify and compare the different approaches
- Provide a structured comparison
Extract Specific Information
- Fetch the documentation page
- Identify the installation requirements section
- Extract and list the specific requirements
Limitations
Only URLs starting with
http:// or https:// are supported. Other protocols (ftp://, file://, etc.) are not processed.Fallback Behavior
If the Gemini API’surlContext feature is unavailable:
- The tool attempts to fetch raw HTML content directly from your machine
- Content is processed locally and sent to the model
- Some features like JavaScript-rendered content may not be available
Response Format
The tool returns synthesized content with:- Source Attribution: Each piece of information is attributed to its source URL
- Structured Content: Content is organized based on your prompt instructions
- Original Context: The full context is preserved for the model to reason about
Security
All web fetches trigger a confirmation dialog showing the exact URLs that will be accessed. Review these carefully before approving.
Next Steps
Web Tools Guide
Practical examples of using web fetch
Web Search
Learn about the web search tool for general queries