Skip to main content
Glama
tahaswx

Serper Search and Scrape MCP Server

by tahaswx

scrape

Extract webpage content including text, metadata, and optional markdown formatting from any URL to gather structured information for analysis or processing.

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

  • The scrape method in SerperSearchTools class is the primary handler that executes the scrape tool logic, delegating to the SerperClient and handling errors.
    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}`);
      }
    }
  • The MCP tool call handler for 'scrape' - extracts URL and includeMarkdown parameters from the request, calls searchTools.scrape(), and returns the JSON result.
    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:143-162 (registration)
    Registration of the 'scrape' tool with its name, description, and inputSchema defining url (required) and includeMarkdown (optional boolean) parameters.
    {
      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"],
      },
    },
  • IScrapeParams interface defines the input schema with url (string) and optional includeMarkdown (boolean) for the scrape tool.
     * Scrape parameters for Serper API.
     */
    export interface IScrapeParams {
      url: string;
      includeMarkdown?: boolean;
    }
  • IScrapeResult interface defines the output schema with text, optional markdown, metadata, jsonld, and credits fields returned by the scrape operation.
     * Represents the result of a scrape operation from the Serper API.
     */
    export interface IScrapeResult {
      text: string;
      markdown?: string;
      metadata?: Record<string, string>;
      jsonld?: Record<string, any>;
      credits?: number;
    }

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.2.0

TDQS

C2.9/5.0
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