Search the web and fetch page content. Use when you need external information like documentation, API references, error message lookups, or any information not available in the local codebase.
Search the internet and fetch web page content.
Run once before first use:
cd {baseDir}
npm install
node {baseDir}/web-search.js "your search query"
Searches DuckDuckGo and prints the top results with titles, URLs, and snippets.
Examples:
node {baseDir}/web-search.js "react useEffect cleanup pattern"
node {baseDir}/web-search.js "ECONNREFUSED node.js fix"
node {baseDir}/web-search.js "tailwind css grid layout"
node {baseDir}/web-fetch.js https://example.com
node {baseDir}/web-fetch.js https://docs.example.com/api "authentication"
Fetches a URL and prints readable content. HTML is converted to markdown. JSON responses are pretty-printed.
The optional second argument extracts content around the first match of that text, useful for targeting a specific section of a long page.
Examples:
node {baseDir}/web-fetch.js https://docs.react.dev/reference/react/useState
node {baseDir}/web-fetch.js https://api.example.com/config.json
node {baseDir}/web-fetch.js https://docs.example.com/api "rate limiting"
Search for information:
node {baseDir}/web-search.js "how to handle CORS in express"
Fetch a relevant result for details:
node {baseDir}/web-fetch.js https://expressjs.com/en/resources/middleware/cors.html
If the page is long, target a specific section:
node {baseDir}/web-fetch.js https://expressjs.com/en/resources/middleware/cors.html "configuration options"