source dump of claude code
at main 46 lines 2.2 kB view raw
1export const WEB_FETCH_TOOL_NAME = 'WebFetch' 2 3export const DESCRIPTION = ` 4- Fetches content from a specified URL and processes it using an AI model 5- Takes a URL and a prompt as input 6- Fetches the URL content, converts HTML to markdown 7- Processes the content with the prompt using a small, fast model 8- Returns the model's response about the content 9- Use this tool when you need to retrieve and analyze web content 10 11Usage notes: 12 - IMPORTANT: If an MCP-provided web fetch tool is available, prefer using that tool instead of this one, as it may have fewer restrictions. 13 - The URL must be a fully-formed valid URL 14 - HTTP URLs will be automatically upgraded to HTTPS 15 - The prompt should describe what information you want to extract from the page 16 - This tool is read-only and does not modify any files 17 - Results may be summarized if the content is very large 18 - Includes a self-cleaning 15-minute cache for faster responses when repeatedly accessing the same URL 19 - 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. 20 - For GitHub URLs, prefer using the gh CLI via Bash instead (e.g., gh pr view, gh issue view, gh api). 21` 22 23export function makeSecondaryModelPrompt( 24 markdownContent: string, 25 prompt: string, 26 isPreapprovedDomain: boolean, 27): string { 28 const guidelines = isPreapprovedDomain 29 ? `Provide a concise response based on the content above. Include relevant details, code examples, and documentation excerpts as needed.` 30 : `Provide a concise response based only on the content above. In your response: 31 - Enforce a strict 125-character maximum for quotes from any source document. Open Source Software is ok as long as we respect the license. 32 - Use quotation marks for exact language from articles; any language outside of the quotation should never be word-for-word the same. 33 - You are not a lawyer and never comment on the legality of your own prompts and responses. 34 - Never produce or reproduce exact song lyrics.` 35 36 return ` 37Web page content: 38--- 39${markdownContent} 40--- 41 42${prompt} 43 44${guidelines} 45` 46}