Skip to main content
Glama

search_web

Search the web using AI-enhanced results, returning content in HTML, Markdown, or structured formats for processing and analysis.

Instructions

Search the web using Crawleo's AI-powered search engine. Returns results with optional AI-enhanced HTML, markdown content, and structured data.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query term. The main keyword or phrase to search for.
max_pagesNoMax result pages to crawl. Each page costs 1 credit. Min: 1
setLangNoLanguage code for search interface (e.g., 'en', 'es', 'fr', 'ar')en
ccNoCountry code for search results (e.g., 'US', 'GB', 'DE', 'EG')
geolocationNoGeo location for searchrandom
deviceNoDevice simulationdesktop
enhanced_htmlNoReturn AI-enhanced, cleaned HTML optimized for processing
raw_htmlNoReturn original, unprocessed HTML of the page
page_textNoReturn extracted plain text without HTML tags
markdownNoReturn content in Markdown format for easy parsing

Implementation Reference

  • The asynchronous handler function that executes the search_web tool. It invokes makeSearchRequest with user arguments, returns JSON-formatted results or an error response.
    async (args) => {
      try {
        const result = await makeSearchRequest<Record<string, unknown>>({
          query: args.query,
          max_pages: args.max_pages,
          setLang: args.setLang,
          cc: args.cc,
          geolocation: args.geolocation,
          device: args.device,
          enhanced_html: args.enhanced_html,
          raw_html: args.raw_html,
          page_text: args.page_text,
          markdown: args.markdown,
        });
    
        return {
          content: [
            {
              type: "text" as const,
              text: JSON.stringify(result, null, 2),
            },
          ],
        };
      } catch (error) {
        const errorMessage = error instanceof Error ? error.message : "Unknown error occurred";
        return {
          content: [
            {
              type: "text" as const,
              text: `Error performing search: ${errorMessage}`,
            },
          ],
          isError: true,
        };
      }
    }
  • Zod input schema for the search_web tool, defining parameters like query, max_pages, language, geolocation, device, and content format options.
    const WebSearchSchema = z.object({
      query: z.string().describe("Search query term. The main keyword or phrase to search for."),
      max_pages: z.number().optional().default(1).describe("Max result pages to crawl. Each page costs 1 credit. Min: 1"),
      setLang: z.string().optional().default("en").describe("Language code for search interface (e.g., 'en', 'es', 'fr', 'ar')"),
      cc: z.string().optional().describe("Country code for search results (e.g., 'US', 'GB', 'DE', 'EG')"),
      geolocation: z.enum(["random", "pl", "gb", "jp", "de", "fr", "es", "us"]).optional().default("random").describe("Geo location for search"),
      device: z.enum(["desktop", "mobile", "tablet"]).optional().default("desktop").describe("Device simulation"),
      enhanced_html: z.boolean().optional().default(true).describe("Return AI-enhanced, cleaned HTML optimized for processing"),
      raw_html: z.boolean().optional().default(false).describe("Return original, unprocessed HTML of the page"),
      page_text: z.boolean().optional().default(false).describe("Return extracted plain text without HTML tags"),
      markdown: z.boolean().optional().default(true).describe("Return content in Markdown format for easy parsing"),
    });
  • src/index.ts:103-143 (registration)
    Registration of the search_web tool on the MCP server, specifying name, description, input schema, and handler function.
    server.tool(
      "search_web",
      "Search the web using Crawleo's AI-powered search engine. Returns results with optional AI-enhanced HTML, markdown content, and structured data.",
      WebSearchSchema.shape,
      async (args) => {
        try {
          const result = await makeSearchRequest<Record<string, unknown>>({
            query: args.query,
            max_pages: args.max_pages,
            setLang: args.setLang,
            cc: args.cc,
            geolocation: args.geolocation,
            device: args.device,
            enhanced_html: args.enhanced_html,
            raw_html: args.raw_html,
            page_text: args.page_text,
            markdown: args.markdown,
          });
    
          return {
            content: [
              {
                type: "text" as const,
                text: JSON.stringify(result, null, 2),
              },
            ],
          };
        } catch (error) {
          const errorMessage = error instanceof Error ? error.message : "Unknown error occurred";
          return {
            content: [
              {
                type: "text" as const,
                text: `Error performing search: ${errorMessage}`,
              },
            ],
            isError: true,
          };
        }
      }
    );
  • Helper function to make authenticated GET requests to the Crawleo web search API endpoint, building query parameters and handling errors.
    async function makeSearchRequest<T>(
      params: Record<string, unknown>
    ): Promise<T> {
      const apiKey = getApiKey();
      
      // Build query string from params
      const queryParams = new URLSearchParams();
      for (const [key, value] of Object.entries(params)) {
        if (value !== undefined && value !== null) {
          queryParams.append(key, String(value));
        }
      }
      
      const url = `${API_BASE_URL}/search?${queryParams.toString()}`;
      
      const response = await fetch(url, {
        method: "GET",
        headers: {
          "x-api-key": apiKey,
        },
      });
    
      if (!response.ok) {
        const errorText = await response.text();
        throw new Error(`API request failed: ${response.status} - ${errorText}`);
      }
    
      return response.json() as Promise<T>;
    }
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 mentions that results include 'optional AI-enhanced HTML, markdown content, and structured data,' which adds some context about output features. However, it fails to disclose critical behavioral traits such as rate limits, authentication needs, costs (implied by 'costs 1 credit' in the schema but not in the description), or error handling. For a search tool with 10 parameters, this is insufficient.

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, consisting of two sentences that directly state the tool's purpose and key output features. There's no wasted verbiage, and it efficiently communicates the core functionality. A slight deduction is made because it could integrate cost or sibling tool context more seamlessly.

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 complexity (10 parameters, no annotations, no output schema), the description is moderately complete. It covers the basic purpose and output formats but lacks details on behavioral aspects, usage guidelines, and output structure. Without annotations or an output schema, the agent must infer much from the input schema alone, leaving gaps in understanding the tool's full 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?

Schema description coverage is 100%, so the schema fully documents all 10 parameters. The description adds minimal value beyond the schema by hinting at 'AI-enhanced' outputs and 'structured data,' but it doesn't elaborate on parameter interactions or provide additional semantic context. This meets the baseline of 3 when the schema does 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: 'Search the web using Crawleo's AI-powered search engine.' It specifies the verb ('Search') and resource ('the web'), and mentions the engine's AI-powered nature. However, it doesn't explicitly differentiate from its sibling tool 'crawl_web' (e.g., by contrasting search vs. crawl operations), 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 its sibling 'crawl_web' or other alternatives. It lacks context about appropriate scenarios, exclusions, or prerequisites (e.g., when to prefer search over crawl). This leaves the agent without usage direction beyond the basic purpose.

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/Crawleo/crawleo-mcp'

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