Skip to main content
Glama
marcopesani

serper-search-scrape-mcp-server

scrape

Extract webpage content including text, metadata, and optional markdown formatting for data collection and analysis.

Instructions

Tool to scrape a webpage and retrieve the text and, optionally, the markdown content. It will retrieve also the JSON-LD metadata and the head metadata.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesThe URL of the webpage to scrape.
includeMarkdownNoWhether to include markdown content.

Implementation Reference

  • Primary MCP server handler for the 'scrape' tool call. Extracts URL and includeMarkdown parameters, invokes the searchTools.scrape method, and returns the result as JSON text content.
    case "scrape": {
      const url = request.params.arguments?.url as string;
      const includeMarkdown = request.params.arguments
        ?.includeMarkdown as boolean;
      const result = await searchTools.scrape({ url, includeMarkdown });
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(result, null, 2),
          },
        ],
      };
    }
  • src/index.ts:144-162 (registration)
    Registration of the 'scrape' tool in the ListToolsRequestSchema handler, including name, description, and input schema validation.
      name: "scrape",
      description:
        "Tool to scrape a webpage and retrieve the text and, optionally, the markdown content. It will retrieve also the JSON-LD metadata and the head metadata.",
      inputSchema: {
        type: "object",
        properties: {
          url: {
            type: "string",
            description: "The URL of the webpage to scrape.",
          },
          includeMarkdown: {
            type: "boolean",
            description: "Whether to include markdown content.",
            default: false,
          },
        },
        required: ["url"],
      },
    },
  • TypeScript interface defining input parameters for scrape operation (matches MCP schema).
    export interface IScrapeParams {
      url: string;
      includeMarkdown?: boolean;
    }
  • Helper method in SerperSearchTools class that wraps the SerperClient.scrape call with error handling; invoked by MCP handler.
    async scrape(params: IScrapeParams): Promise<IScrapeResult> {
      try {
        const result = await this.serperClient.scrape(params);
        return result;
      } catch (error) {
        throw new Error(`SearchTool: failed to scrape. ${error}`);
      }
    }
  • Core implementation of scrape in SerperClient: makes HTTP POST to scrape.serper.dev API with params, handles response and errors.
    async scrape(params: IScrapeParams): Promise<IScrapeResult> {
      if (!params.url) {
        throw new Error("URL is required for scraping");
      }
      try {
        const response = await fetch("https://scrape.serper.dev", {
          method: "POST",
          headers: {
            "Content-Type": "application/json",
            "X-API-KEY": this.apiKey,
          },
          body: JSON.stringify(params),
          redirect: "follow",
        });
        if (!response.ok) {
          const errorText = await response.text();
          throw new Error(
            `Serper API error: ${response.status} ${response.statusText} - ${errorText}`
          );
        }
        const result = (await response.json()) as IScrapeResult;
        return result;
      } catch (error) {
        console.error(error);
        throw error;
      }
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states what the tool retrieves (text, markdown, JSON-LD, head metadata) but lacks critical behavioral details such as rate limits, authentication needs, error handling, or whether it performs destructive actions (e.g., modifying data). For a web scraping tool with no annotation coverage, this is a significant gap in transparency.

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 concise and front-loaded in a single sentence, efficiently stating the core functionality without unnecessary details. Every part earns its place, though it could be slightly more structured (e.g., separating outputs). It avoids redundancy and is appropriately sized for the tool's complexity.

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

Completeness3/5

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

Given the tool's moderate complexity (web scraping with two parameters), no annotations, and no output schema, the description is partially complete. It covers what the tool retrieves but misses behavioral aspects like rate limits or error handling. Without an output schema, it should ideally describe return values more explicitly, but it does list the types of content retrieved, providing some context.

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

Parameters3/5

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

The input schema has 100% description coverage, clearly documenting both parameters ('url' and 'includeMarkdown'). The description adds no additional meaning beyond the schema—it doesn't explain parameter interactions, constraints, or usage examples. With high schema coverage, the baseline score of 3 is appropriate as the schema handles the heavy lifting.

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

Purpose4/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: 'scrape a webpage and retrieve the text and, optionally, the markdown content. It will retrieve also the JSON-LD metadata and the head metadata.' This specifies the verb (scrape), resource (webpage), and outputs (text, markdown, JSON-LD, head metadata). However, it doesn't explicitly differentiate from the sibling tool 'google_search', which likely serves a different purpose (searching vs. scraping).

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention the sibling tool 'google_search' or any other scraping-related tools, nor does it specify prerequisites, contexts, or exclusions for usage. This leaves the agent without clear direction on tool selection.

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

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