fetch_website_single
Extract and convert content from a single webpage into clean markdown format using a specified URL, ensuring structured and readable output for further use.
Instructions
Fetch content from a single webpage and convert to clean markdown
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| timeout | No | Request timeout in milliseconds (default: 10000) | |
| url | Yes | The URL to fetch |
Implementation Reference
- src/server.ts:345-364 (registration)Registration of the fetch_website_single tool in the TOOLS array, including name, description, and input schema. This is used by the ListToolsRequestHandler.{ name: "fetch_website_single", description: "Fetch content from a single webpage and convert to clean markdown", inputSchema: { type: "object", properties: { url: { type: "string", description: "The URL to fetch", }, timeout: { type: "number", description: "Request timeout in milliseconds (default: 10000)", default: 10000, }, }, required: ["url"], }, }, ];
- src/server.ts:348-362 (schema)Input schema for the fetch_website_single tool defining required 'url' parameter and optional 'timeout'.inputSchema: { type: "object", properties: { url: { type: "string", description: "The URL to fetch", }, timeout: { type: "number", description: "Request timeout in milliseconds (default: 10000)", default: 10000, }, }, required: ["url"], },
- src/server.ts:433-461 (handler)Handler implementation for fetch_website_single tool. Validates input, configures scraper options for single page (maxDepth:0, maxPages:1), fetches content, converts to markdown, and returns as text content block.case "fetch_website_single": { const { url, timeout = 10000 } = args as any; if (!url) { throw new Error("URL is required"); } try { const options: FetchOptions = { maxDepth: 0, maxPages: 1, timeout, }; const markdown = await scraper.scrapeWebsite(url, options); return { content: [ { type: "text", text: markdown, }, ], }; } catch (error) { throw new Error(`Failed to fetch single page: ${error}`); } }