Web Scraper
MCP ToolsExtract content from any URL. Returns structured data with title, text, and metadata.
// web-scraper.ts
import { defineHandler } from '@fold-run/runtime'
export default defineHandler(async (fold) => {
const { url } = await fold.body<{ url: string }>();
const response = await fetch(url);
const html = await response.text();
// Parse title and body text
const title = html.match(/<title>(.*?)<\/title>/)?.[1] || "";
const text = html.replace(/<[^>]+>/g, " ").trim();
return fold.json({ url, title, text });
});