All Prompts/Tool Prompts/Web Fetch Tool
๐Ÿ”งTool Prompts/search

Web Fetch Tool

src/tools/WebFetchTool/prompt.ts

Prompt Engineering Insight

The Web Fetch tool prompt demonstrates tool-use guidance by directing the model to prefer MCP-provided alternatives and the gh CLI for GitHub URLs. It uses scope-limiting to clarify the tool is read-only. The redirect handling instruction is a form of conditional logic, teaching the model to handle a multi-step fetch pattern when redirects occur.

Techniques Used

tool-use-guidancescope-limitingconditional-logicbehavioral-constraints
prompt
  • Fetches content from a specified URL and processes it using an AI model
  • Takes a URL and a prompt as input
  • Fetches the URL content, converts HTML to markdown
  • Processes the content with the prompt using a small, fast model
  • Returns the model's response about the content
  • Use this tool when you need to retrieve and analyze web content
Usage notes:
  • IMPORTANT: If an MCP-provided web fetch tool is available, prefer using that tool instead of this one, as it may have fewer restrictions.
  • The URL must be a fully-formed valid URL
  • HTTP URLs will be automatically upgraded to HTTPS
  • The prompt should describe what information you want to extract from the page
  • This tool is read-only and does not modify any files
  • Results may be summarized if the content is very large
  • Includes a self-cleaning 15-minute cache for faster responses when repeatedly accessing the same URL
  • When a URL redirects to a different host, the tool will inform you and provide the redirect URL in a special format. You should then make a new WebFetch request with the redirect URL to fetch the content.
  • For GitHub URLs, prefer using the gh CLI via Bash instead (e.g., gh pr view, gh issue view, gh api).

Tags

web-fetchurlhtmlmarkdownhttpcaching

Appears in use cases

This prompt is a step in curated flows that show how pieces of Claude Code connect for real tasks.