Skip to main content
Glama
ScrapeGraphAI

ScrapeGraph MCP Server

Official

markdownify

Read-onlyIdempotent

Convert webpages into clean, formatted markdown for extracting content from documentation, articles, and web pages. Fetches any webpage and transforms HTML content into readable markdown format.

Instructions

Convert a webpage into clean, formatted markdown.

This tool fetches any webpage and converts its content into clean, readable markdown format. Useful for extracting content from documentation, articles, and web pages for further processing. Costs 2 credits per page. Read-only operation with no side effects.

Args: website_url (str): The complete URL of the webpage to convert to markdown format. - Must include protocol (http:// or https://) - Supports most web content types (HTML, articles, documentation) - Works with both static and dynamic content - Examples: * https://example.com/page * https://docs.python.org/3/tutorial/ * https://github.com/user/repo/README.md - Invalid examples: * example.com (missing protocol) * ftp://example.com (unsupported protocol) * localhost:3000 (missing protocol)

Returns: Dictionary containing: - markdown: The converted markdown content as a string - metadata: Additional information about the conversion (title, description, etc.) - status: Success/error status of the operation - credits_used: Number of credits consumed (always 2 for this operation)

Raises: ValueError: If website_url is malformed or missing protocol HTTPError: If the webpage cannot be accessed or returns an error TimeoutError: If the webpage takes too long to load (>120 seconds)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
website_urlYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • MCP tool handler function for the 'markdownify' tool. It retrieves the API key, creates a ScapeGraphClient instance, and calls its markdownify method to convert the given website URL to markdown.
    @mcp.tool(annotations={"readOnlyHint": True, "destructiveHint": False, "idempotentHint": True})
    def markdownify(website_url: str, ctx: Context) -> Dict[str, Any]:
        """
        Convert a webpage into clean, formatted markdown.
    
        This tool fetches any webpage and converts its content into clean, readable markdown format.
        Useful for extracting content from documentation, articles, and web pages for further processing.
        Costs 2 credits per page. Read-only operation with no side effects.
    
        Args:
            website_url (str): The complete URL of the webpage to convert to markdown format.
                - Must include protocol (http:// or https://)
                - Supports most web content types (HTML, articles, documentation)
                - Works with both static and dynamic content
                - Examples:
                  * https://example.com/page
                  * https://docs.python.org/3/tutorial/
                  * https://github.com/user/repo/README.md
                - Invalid examples:
                  * example.com (missing protocol)
                  * ftp://example.com (unsupported protocol)
                  * localhost:3000 (missing protocol)
    
        Returns:
            Dictionary containing:
            - markdown: The converted markdown content as a string
            - metadata: Additional information about the conversion (title, description, etc.)
            - status: Success/error status of the operation
            - credits_used: Number of credits consumed (always 2 for this operation)
    
        Raises:
            ValueError: If website_url is malformed or missing protocol
            HTTPError: If the webpage cannot be accessed or returns an error
            TimeoutError: If the webpage takes too long to load (>120 seconds)
        """
        try:
            api_key = get_api_key(ctx)
            client = ScapeGraphClient(api_key)
            return client.markdownify(website_url)
        except Exception as e:
            return {"error": str(e)}
  • Core helper method in ScapeGraphClient class that performs the HTTP POST request to the ScrapeGraph API's /markdownify endpoint with the website_url, returning the JSON response containing the markdown.
    def markdownify(self, website_url: str) -> Dict[str, Any]:
        """
        Convert a webpage into clean, formatted markdown.
    
        Args:
            website_url: URL of the webpage to convert
    
        Returns:
            Dictionary containing the markdown result
        """
        url = f"{self.BASE_URL}/markdownify"
        data = {
            "website_url": website_url
        }
    
        response = self.client.post(url, headers=self.headers, json=data)
    
        if response.status_code != 200:
            error_msg = f"Error {response.status_code}: {response.text}"
            raise Exception(error_msg)
    
        return response.json()
  • Registration of the 'markdownify' tool using the @mcp.tool decorator on the FastMCP instance.
    @mcp.tool(annotations={"readOnlyHint": True, "destructiveHint": False, "idempotentHint": True})
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description adds significant behavioral context beyond what annotations provide. While annotations indicate read-only, idempotent, and non-destructive operations, the description adds: cost information ('Costs 2 credits per page'), timeout behavior ('>120 seconds'), error conditions (ValueError, HTTPError, TimeoutError), and specific constraints about protocol requirements. This provides rich operational context not captured in annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with clear sections (purpose, usage, cost, args, returns, raises) and front-loaded key information. While comprehensive, it's appropriately sized for a tool with complex behavior and parameter requirements. Some sentences could potentially be more concise, but overall structure is excellent.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity, the description provides complete context. It covers purpose, usage guidelines, behavioral traits, parameter semantics, return values, and error conditions. With an output schema present, the return value documentation is appropriately detailed but not redundant. The description addresses all aspects needed for effective tool use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage, the description fully compensates by providing extensive parameter documentation. It explains the website_url parameter's format requirements, provides valid and invalid examples, and details content type support. This adds substantial meaning beyond the bare schema definition.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with specific verb ('convert') and resource ('webpage into clean, formatted markdown'). It distinguishes from sibling tools by specifying this is specifically for markdown conversion rather than general scraping or crawling operations.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context for when to use this tool ('Useful for extracting content from documentation, articles, and web pages for further processing'). However, it doesn't explicitly state when NOT to use it or name specific alternatives among the sibling tools, though the purpose differentiation implies alternatives exist.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ScrapeGraphAI/scrapegraph-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server