Skip to main content
Glama
divslingerx

Memory Store MCP Server

by divslingerx

search_web

Perform web searches via Google to retrieve structured JSON results for integration with MCP-enabled systems.

Instructions

Search the web using Google

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query

Implementation Reference

  • MCP CallToolRequestSchema handler that validates the tool name 'search_web', launches Puppeteer browser if needed, navigates to Google search, extracts top results (titles and URLs), and returns them as formatted JSON text content.
    this.server.setRequestHandler(CallToolRequestSchema, async (request) => {
      // Validate requested tool name
      if (request.params.name !== "search_web") {
        throw new McpError(
          ErrorCode.MethodNotFound,
          `Unknown tool: ${request.params.name}`
        );
      }
    
      // Initialize Puppeteer browser if not already running
      if (!this.browser) {
        this.browser = await puppeteer.launch();
      }
    
      // Create new browser page
      const page = await this.browser.newPage();
    
      // Validate request arguments
      if (
        !request.params.arguments ||
        typeof request.params.arguments !== "object"
      ) {
        throw new McpError(
          ErrorCode.InvalidParams,
          "Invalid arguments provided"
        );
      }
    
      const args = request.params.arguments;
      if (
        !args ||
        typeof args !== "object" ||
        !("query" in args) ||
        typeof args.query !== "string"
      ) {
        throw new McpError(
          ErrorCode.InvalidParams,
          "Query parameter is required and must be a string"
        );
      }
    
      // Perform Google search using Puppeteer
      await page.goto(
        `https://www.google.com/search?q=${encodeURIComponent(args.query)}`
      );
    
      // Extract search results from page
      const results = await page.evaluate(() => {
        return Array.from(document.querySelectorAll("h3")).map((el) => ({
          title: el.textContent,
          url: el.closest("a")?.href,
        }));
      });
    
      // Clean up browser page
      await page.close();
    
      // Return results as JSON
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(results, null, 2),
          },
        ],
      };
    });
  • Tool registration in ListToolsRequestSchema handler, defining 'search_web' tool with description and input schema requiring a 'query' string.
    this.server.setRequestHandler(ListToolsRequestSchema, async () => ({
      tools: [
        {
          name: "search_web", // Tool name
          description: "Search the web using Google",
          inputSchema: {
            type: "object",
            properties: {
              query: {
                type: "string",
                description: "Search query",
              },
            },
            required: ["query"], // Query parameter is mandatory
          },
        },
      ],
    }));
  • Input schema for 'search_web' tool, specifying an object with required 'query' string property.
    inputSchema: {
      type: "object",
      properties: {
        query: {
          type: "string",
          description: "Search query",
        },
      },
      required: ["query"], // Query parameter is mandatory
    },
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It only states the basic function without mentioning rate limits, authentication needs, result format, pagination, or any other operational characteristics that would help an agent understand how to interact with it effectively.

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

Conciseness5/5

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

The description is extremely concise at just four words, front-loaded with the core function, and contains no unnecessary information. Every word earns its place in communicating the essential purpose.

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

Completeness2/5

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

For a search tool with no annotations and no output schema, the description is insufficiently complete. It doesn't explain what kind of results to expect, how they're structured, or any behavioral aspects like limitations or error handling, leaving significant gaps for agent understanding.

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 schema description coverage is 100%, so the input schema already documents the single 'query' parameter adequately. The description doesn't add any additional meaning or context about the parameter beyond what's in the schema, which meets the baseline for high schema coverage.

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 action ('Search') and target ('the web using Google'), providing a specific verb+resource combination. However, with no sibling tools mentioned, there's no opportunity to distinguish from alternatives, which prevents a perfect score.

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 other search methods or tools, nor does it mention any prerequisites or exclusions. It simply states what the tool does without contextual usage information.

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

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