Skip to main content
Glama

crawl_web

Extract webpage content in Markdown, raw HTML, or AI-enhanced formats for analysis and processing.

Instructions

Crawl a specific webpage and extract its content in various formats including Markdown, raw HTML, and AI-enhanced HTML.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesURL to crawl and extract content from
markdownNoReturn content in Markdown format
raw_htmlNoReturn original, unprocessed HTML
enhanced_htmlNoReturn AI-enhanced, cleaned HTML

Implementation Reference

  • The handler function for the 'crawl_web' tool. It calls makeCrawlRequest with the provided arguments, returns the JSON result, or an error message if the request fails.
    async (args) => {
      try {
        const result = await makeCrawlRequest<Record<string, unknown>>({
          url: args.url,
          markdown: args.markdown,
          raw_html: args.raw_html,
          enhanced_html: args.enhanced_html,
        });
    
        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 crawling URL: ${errorMessage}`,
            },
          ],
          isError: true,
        };
      }
    }
  • Zod schema defining the input parameters for the 'crawl_web' tool, including URL and format options.
    const WebCrawlSchema = z.object({
      url: z.string().describe("URL to crawl and extract content from"),
      markdown: z.boolean().optional().default(true).describe("Return content in Markdown format"),
      raw_html: z.boolean().optional().default(false).describe("Return original, unprocessed HTML"),
      enhanced_html: z.boolean().optional().default(true).describe("Return AI-enhanced, cleaned HTML"),
    });
  • src/index.ts:146-180 (registration)
    Registration of the 'crawl_web' tool using server.tool(), including name, description, schema, and inline handler.
    server.tool(
      "crawl_web",
      "Crawl a specific webpage and extract its content in various formats including Markdown, raw HTML, and AI-enhanced HTML.",
      WebCrawlSchema.shape,
      async (args) => {
        try {
          const result = await makeCrawlRequest<Record<string, unknown>>({
            url: args.url,
            markdown: args.markdown,
            raw_html: args.raw_html,
            enhanced_html: args.enhanced_html,
          });
    
          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 crawling URL: ${errorMessage}`,
              },
            ],
            isError: true,
          };
        }
      }
    );
  • Helper function that performs the POST request to the Crawleo /crawl API endpoint using the provided body and API key.
    async function makeCrawlRequest<T>(
      body: Record<string, unknown>
    ): Promise<T> {
      const apiKey = getApiKey();
      
      const response = await fetch(`${API_BASE_URL}/crawl`, {
        method: "POST",
        headers: {
          "Content-Type": "application/json",
          "x-api-key": apiKey,
        },
        body: JSON.stringify(body),
      });
    
      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 the extraction of content in various formats but fails to disclose critical behavioral traits such as rate limits, authentication requirements, error handling, or what happens when crawling fails. For a web crawling tool with zero 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.

Conciseness5/5

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

The description is a single, efficient sentence that front-loads the core purpose without unnecessary words. Every part of the sentence contributes directly to understanding the tool's function, making it highly concise and well-structured.

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?

Given the complexity of web crawling (which involves network operations, potential failures, and format handling) and the lack of annotations and output schema, the description is incomplete. It doesn't address error conditions, return formats beyond naming them, or operational constraints, leaving significant gaps for the agent to infer behavior.

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 four parameters thoroughly. The description adds minimal value beyond the schema by mentioning 'various formats including Markdown, raw HTML, and AI-enhanced HTML,' which loosely corresponds to the boolean parameters but doesn't provide additional semantic context. Baseline 3 is appropriate 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 with a specific verb ('crawl') and resource ('webpage'), and specifies the action ('extract its content in various formats'). It distinguishes from the sibling 'search_web' by focusing on content extraction from a specific URL rather than searching. However, it doesn't explicitly contrast with the sibling beyond the different action verbs.

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 the sibling 'search_web' or other alternatives. It mentions what the tool does but offers no context about appropriate use cases, prerequisites, or exclusions. 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/Crawleo/crawleo-mcp'

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