MCPcopy Create free account
hub / github.com/ScrapeGraphAI/scrapecraft / markdownify_tool

Function markdownify_tool

backend/app/agents/tools/scraping_tools.py:212–247  ·  view source on GitHub ↗

Convert a webpage to clean, formatted markdown. This tool extracts the main content from a webpage and converts it to markdown format. Useful for documentation, content analysis, or creating readable versions of web pages. Args: website_url: The URL to convert

(website_url: str)

Source from the content-addressed store, hash-verified

210
211@tool("markdownify", args_schema=MarkdownifyInput)
212async def markdownify_tool(website_url: str) -> Dict[str, Any]:
213 """
214 Convert a webpage to clean, formatted markdown.
215
216 This tool extracts the main content from a webpage and converts it
217 to markdown format. Useful for documentation, content analysis, or
218 creating readable versions of web pages.
219
220 Args:
221 website_url: The URL to convert to markdown
222
223 Returns:
224 Dictionary containing the markdown content
225 """
226 try:
227 async with AsyncClient(api_key=settings.SCRAPEGRAPH_API_KEY) as client:
228 logger.info(f"Markdownify: Converting {website_url} to markdown")
229
230 response = await client.smartscraper(
231 website_url=website_url,
232 user_prompt="Convert this entire webpage to clean markdown format, preserving structure and formatting"
233 )
234
235 return {
236 "success": True,
237 "markdown": response.get("result", ""),
238 "url": website_url
239 }
240
241 except Exception as e:
242 logger.error(f"Markdownify failed for {website_url}: {str(e)}")
243 return {
244 "success": False,
245 "error": str(e),
246 "url": website_url
247 }
248
249
250@tool("validate_urls")

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected