Skip to main content
Glama
cmann50

MCP Chrome Google Search

by cmann50

web-search

Search webpages using plain text, with options to filter results by site, timeframe, and page number. Ideal for targeted queries and accessing specific content quickly.

Instructions

Search webpages and get a specific page of results (each page has ~10 results). Optionally filter by site and timeframe.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pageNumberNoWhich page of results to fetch (1-5). Each page contains ~10 results
query_textYesPlain text to search for (no Google operators plain text only - use other parameters for site/date filtering)
siteNoLimit search to specific domain (e.g. 'github.com' or 'docs.python.org')
timeframeNoTime range filter (h=hour, d=day, w=week, m=month, y=year)

Implementation Reference

  • Primary registration of the 'web-search' tool using server.tool(), including description, Zod schema, and inline handler function.
    server.tool(
      "web-search",
      "Search webpages and get a specific page of results (each page has ~10 results). Optionally filter by site and timeframe.",
      {
        query_text: z.string().min(1).describe("Plain text to search for (no Google operators plain text only - use other parameters for site/date filtering)"),
        site: z.string().optional().describe("Limit search to specific domain (e.g. 'github.com' or 'docs.python.org')"),
        timeframe: z.enum(['h', 'd', 'w', 'm', 'y']).optional().describe("Time range filter (h=hour, d=day, w=week, m=month, y=year)"),
        pageNumber: z.number().min(1).max(5).optional().default(1).describe(
          "Which page of results to fetch (1-5). Each page contains ~10 results"
        )
      },
      async ({ query_text, site, timeframe, pageNumber }) => {
        console.error(`Executing Google search for: ${query_text} (page ${pageNumber})`);
        try {
          const searchParams = { query_text, site, timeframe };
          const results = await performGoogleSearch(searchParams, pageNumber);
    
          return {
            content: [{
              type: "text" as const,
              text: results
            }]
          };
        } catch (error) {
          return {
            content: [{
              type: "text" as const,
              text: `Search failed - please try again: ${error instanceof Error ? error.message : String(error)}`
            }],
            isError: true
          };
        }
      }
    );
  • The async handler function passed to server.tool that executes the web-search logic by calling performGoogleSearch and handling response/error formatting.
    async ({ query_text, site, timeframe, pageNumber }) => {
      console.error(`Executing Google search for: ${query_text} (page ${pageNumber})`);
      try {
        const searchParams = { query_text, site, timeframe };
        const results = await performGoogleSearch(searchParams, pageNumber);
    
        return {
          content: [{
            type: "text" as const,
            text: results
          }]
        };
      } catch (error) {
        return {
          content: [{
            type: "text" as const,
            text: `Search failed - please try again: ${error instanceof Error ? error.message : String(error)}`
          }],
          isError: true
        };
      }
    }
  • Zod schema defining input parameters for the web-search tool.
    {
      query_text: z.string().min(1).describe("Plain text to search for (no Google operators plain text only - use other parameters for site/date filtering)"),
      site: z.string().optional().describe("Limit search to specific domain (e.g. 'github.com' or 'docs.python.org')"),
      timeframe: z.enum(['h', 'd', 'w', 'm', 'y']).optional().describe("Time range filter (h=hour, d=day, w=week, m=month, y=year)"),
      pageNumber: z.number().min(1).max(5).optional().default(1).describe(
        "Which page of results to fetch (1-5). Each page contains ~10 results"
      )
    },
  • Core helper function that orchestrates fetching multiple pages of Google search results using fetchSearchPage, collects and formats them as text.
    export async function performGoogleSearch(searchParams: SearchParams, pages: number = 1): Promise<string> {
      try {
        const allResults: SearchResult[] = [];
        
        // Fetch results from multiple pages
        for (let page = 1; page <= pages; page++) {
          const pageResults = await fetchSearchPage(searchParams, page);
          allResults.push(...pageResults);
          
          // Add a small delay between page fetches
          if (page < pages) {
            await new Promise(resolve => setTimeout(resolve, 1000));
          }
        }
        
        return allResults.map(r => `${r.url}\n${r.description}`).join('\n\n');
      } catch (error: unknown) {
        const errorMessage = error instanceof Error ? error.message : String(error);
        throw new Error(`Failed to perform Google search: ${errorMessage}`);
      }
    }
  • TypeScript interfaces defining SearchParams (input) and SearchResult (output items) used throughout the search implementation.
    export interface SearchParams {
      query_text: string;
      site?: string;
      timeframe?: 'h' | 'd' | 'w' | 'm' | 'y';
    }
    
    export interface SearchResult {
      url: string;
      description: string;
    }
  • src/index.ts:13-13 (registration)
    Top-level call to register the search tools on the MCP server instance.
    registerSearchTool(server);
Behavior3/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 adds some context beyond basic functionality: it mentions pagination ('each page has ~10 results') and optional filtering capabilities. However, it doesn't cover important aspects like rate limits, authentication needs, error handling, or what the output looks like (e.g., result format), which are significant gaps for a search tool.

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 and front-loaded: it states the core purpose in the first clause and adds key details in a second sentence. Every word earns its place, with no redundancy or fluff, making it highly efficient for quick understanding.

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 (4 parameters, no output schema, no annotations), the description is somewhat complete but has gaps. It covers the basic operation and filtering options but lacks details on output format, error cases, or integration with the sibling tool. Without annotations or output schema, more behavioral context would be beneficial for full completeness.

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?

Schema description coverage is 100%, so the schema already documents all parameters thoroughly. The description adds minimal value beyond the schema by hinting at the optional nature of site and timeframe filters, but it doesn't provide additional semantic context or usage examples. This 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 tool's purpose: 'Search webpages and get a specific page of results.' It specifies the verb ('search') and resource ('webpages'), and distinguishes it from the sibling tool 'web_fetch' by implying this is for search results rather than fetching specific pages. However, it doesn't explicitly contrast with the sibling, keeping it from 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 Guidelines3/5

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

The description provides implied usage context by mentioning optional filters ('Optionally filter by site and timeframe'), which suggests when to use these parameters. However, it lacks explicit guidance on when to choose this tool over the sibling 'web_fetch' or any other alternatives, and doesn't specify prerequisites or exclusions, leaving room for ambiguity.

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

Related 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/cmann50/mcp-chrome-google-search'

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