Skip to main content

Overview

The Fetch tool retrieves raw content from URLs and returns it in a specified format (text, markdown, or HTML) without any AI processing or interpretation. Use this for simple, fast content retrieval when you need direct access to web resources.
url
string
required
The URL to fetch content from. Must start with http:// or https://
format
string
required
The format to return the content in. Options: text, markdown, or html
timeout
number
Optional timeout in seconds (max 120). If not specified, uses a default timeout.

Features

  • Three output formats - Text, Markdown, or HTML
  • Automatic redirects - Handles HTTP redirects transparently
  • Fast and lightweight - No AI processing overhead
  • Configurable timeout - Prevent hanging on slow sites
  • Input validation - Validates parameters before making requests

Usage

Fetch Plain Text Content

{
  "url": "https://api.example.com/status",
  "format": "text"
}
Returns the raw text content from the URL.

Fetch as Markdown

{
  "url": "https://example.com/blog/post",
  "format": "markdown"
}
Converts HTML content to Markdown format for easier reading.

Fetch with Custom Timeout

{
  "url": "https://slow-site.example.com/data",
  "format": "text",
  "timeout": 60
}
Sets a 60-second timeout for the request.

Format Options

FormatWhen to UseExample Use Case
textPlain text content or simple API responsesFetching API status, text files, simple data
markdownContent that should be rendered with formattingDocumentation, blog posts, articles
htmlRaw HTML structure neededParsing HTML, template analysis

When to Use

Use the Fetch tool for simple, direct content retrieval. For content that needs analysis or extraction, consider using higher-level tools instead.
Use the Fetch tool when you need:
  • Raw, unprocessed content from a URL
  • Direct access to API responses or JSON data
  • HTML/text/markdown content without interpretation
  • Simple, fast content retrieval
  • To save tokens by avoiding AI processing
Do NOT use the Fetch tool when you need to:
  • Extract specific information from a webpage (use specialized extraction tools)
  • Answer questions about web content (use agentic tools)
  • Analyze or summarize web pages (use agentic tools)

Limitations

The Fetch tool has a maximum response size of 5MB. Attempting to fetch larger files will result in an error.
  • Max response size: 5MB
  • Only supports HTTP and HTTPS protocols
  • Cannot handle authentication or cookies
  • Some websites may block automated requests
  • Returns raw content only - no analysis or extraction
  • No JavaScript execution (fetches static HTML only)

Tips

  • Use text format for plain text content or simple API responses
  • Use markdown format for content that should be rendered with formatting
  • Use html format when you need the raw HTML structure
  • Set appropriate timeouts for potentially slow websites
  • For authenticated APIs, ensure the endpoint doesn’t require authentication or use appropriate headers

Common Use Cases

Fetching API Data

{
  "url": "https://api.github.com/repos/charmbracelet/crush",
  "format": "text"
}
Retrieves JSON data from a REST API.

Reading Documentation

{
  "url": "https://docs.example.com/getting-started",
  "format": "markdown"
}
Converts documentation HTML to readable Markdown.

Downloading Configuration Files

{
  "url": "https://example.com/config.json",
  "format": "text",
  "timeout": 30
}
Downloads a configuration file with a 30-second timeout.

Error Handling

Common errors and solutions:
  • Invalid URL format - Ensure URL starts with http:// or https://
  • Invalid format - Use one of: text, markdown, html
  • Timeout - Increase the timeout value or check network connectivity
  • 403 Forbidden - Site may be blocking automated requests
  • Response too large - File exceeds 5MB limit

See Also

  • Bash Tool - Execute curl/wget commands for advanced use cases
  • Grep Tool - Search fetched content
  • Write Tool - Save fetched content to files

Build docs developers (and LLMs) love