Skip to main content
Glama
garylab
by garylab

webpage_scrape

Extract webpage content by URL to retrieve text and optionally include markdown formatting for analysis or processing.

Instructions

Scrape webpage by url

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesThe url to scrape
includeMarkdownNoInclude markdown in the response (boolean value as string: 'true' or 'false')false

Implementation Reference

  • Core handler function for webpage_scrape tool. Posts the request to the scrape.serper.dev API endpoint.
    async def scape(request: WebpageRequest) -> Dict[str, Any]: url = "https://scrape.serper.dev" return await fetch_json(url, request)
  • Dispatch handler in call_tool for the webpage_scrape tool, validates input and invokes scape.
    if name == SerperTools.WEBPAGE_SCRAPE.value: request = WebpageRequest(**arguments) result = await scape(request) return [TextContent(text=json.dumps(result, indent=2), type="text")]
  • Pydantic schema for input validation of webpage_scrape tool.
    class WebpageRequest(BaseModel): url: str = Field(..., description="The url to scrape") includeMarkdown: Optional[str] = Field( "false", pattern=r"^(true|false)$", description="Include markdown in the response (boolean value as string: 'true' or 'false')", )
  • Registration of the webpage_scrape tool in the MCP list_tools handler.
    tools.append(Tool( name=SerperTools.WEBPAGE_SCRAPE, description="Scrape webpage by url", inputSchema=WebpageRequest.model_json_schema(), ))
  • Enum definition providing the tool name constant.
    WEBPAGE_SCRAPE = "webpage_scrape"

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/garylab/serper-mcp-server'

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