get_markdown
Extract clean markdown content from webpages for language model processing, with JavaScript rendering and JSON output options.
Instructions
Get markdown content from a webpage using skrape.ai
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | URL of the webpage to scrape | |
| returnJson | No | Whether to return JSON response (true) or raw markdown (false) | |
| options | No | Additional scraping options |
Implementation Reference
- src/index.ts:70-104 (handler)The main handler for the 'get_markdown' tool. It destructures arguments, validates the URL, calls the Skrape.ai API via axios, handles the response as markdown or JSON, and manages errors.case "get_markdown": { const { url, returnJson = false, options = { renderJs: true } } = request.params.arguments || {}; if (!url || typeof url !== "string") { throw new McpError(ErrorCode.InvalidParams, "URL is required and must be a string"); } try { const response = await axios.post( "https://skrape.ai/api/markdown", { url, options }, { headers: { "Authorization": `Bearer ${API_KEY}`, "Content-Type": returnJson ? "application/json" : "text/markdown" } } ); return { content: [{ type: "text", text: returnJson ? JSON.stringify(response.data, null, 2) : response.data }] }; } catch (error) { if (axios.isAxiosError(error)) { throw new McpError( ErrorCode.InternalError, `Skrape API error: ${error.response?.data?.message || error.message}` ); } throw error; } }
- src/index.ts:36-62 (schema)Input schema for the 'get_markdown' tool defining the expected parameters: url (required), returnJson, and options with renderJs.inputSchema: { type: "object", properties: { url: { type: "string", description: "URL of the webpage to scrape" }, returnJson: { type: "boolean", description: "Whether to return JSON response (true) or raw markdown (false)", default: false }, options: { type: "object", description: "Additional scraping options", properties: { renderJs: { type: "boolean", description: "Whether to render the JavaScript content of the website", default: true } }, default: { renderJs: true } } }, required: ["url"] }
- src/index.ts:33-63 (registration)Registration of the 'get_markdown' tool in the ListTools handler response, providing name, description, and schema.{ name: "get_markdown", description: "Get markdown content from a webpage using skrape.ai", inputSchema: { type: "object", properties: { url: { type: "string", description: "URL of the webpage to scrape" }, returnJson: { type: "boolean", description: "Whether to return JSON response (true) or raw markdown (false)", default: false }, options: { type: "object", description: "Additional scraping options", properties: { renderJs: { type: "boolean", description: "Whether to render the JavaScript content of the website", default: true } }, default: { renderJs: true } } }, required: ["url"] } }