Skip to main content
Glama

get_content

Extract rendered HTML content from webpages for web scraping and content analysis. Use this tool to retrieve fully loaded page content with options to wait for specific elements or conditions before extraction.

Instructions

Extract rendered HTML content from a webpage

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYes
waitForSelectorNo
waitForFunctionNo

Implementation Reference

  • Primary MCP server handler for the 'get_content' tool. Validates arguments, calls BrowserlessClient.getContent, and formats the response as MCP content blocks including extracted HTML.
    case 'get_content': {
      if (!args) throw new Error('Arguments are required');
      const result = await this.client!.getContent(args as any);
      if (result.success && result.data) {
        return {
          content: [
            {
              type: 'text',
              text: `Content extracted successfully from ${result.data.url}`,
            },
            {
              type: 'text',
              text: `Title: ${result.data.title}`,
            },
            {
              type: 'text',
              text: result.data.html,
            },
          ],
        };
      } else {
        throw new Error(result.error || 'Failed to get content');
      }
    }
  • BrowserlessClient helper method that implements the core logic by making an HTTP POST request to the Browserless server '/content' endpoint to extract webpage content.
    async getContent(request: ContentRequest): Promise<BrowserlessResponse<ContentResponse>> {
      try {
        const response: AxiosResponse<ContentResponse> = await this.httpClient.post('/content', request);
    
        return {
          success: true,
          data: response.data,
        };
      } catch (error) {
        return this.handleError(error);
      }
    }
  • src/index.ts:110-134 (registration)
    Tool registration in the ListTools response, defining the name, description, and input schema for 'get_content'.
    {
      name: 'get_content',
      description: 'Extract rendered HTML content from a webpage',
      inputSchema: {
        type: 'object',
        properties: {
          url: { type: 'string' },
          waitForSelector: {
            type: 'object',
            properties: {
              selector: { type: 'string' },
              timeout: { type: 'number' },
            },
          },
          waitForFunction: {
            type: 'object',
            properties: {
              fn: { type: 'string' },
              timeout: { type: 'number' },
            },
          },
        },
        required: ['url'],
      },
    },
  • Zod schema definition for ContentRequest type used in getContent requests, providing detailed input validation.
    export const ContentRequestSchema = z.object({
      url: z.string(),
      gotoOptions: z.object({
        waitUntil: z.string().optional(),
        timeout: z.number().optional(),
      }).optional(),
      waitForSelector: WaitForSelectorSchema.optional(),
      waitForFunction: WaitForFunctionSchema.optional(),
      waitForTimeout: z.number().optional(),
      addScriptTag: z.array(ScriptTagSchema).optional(),
      headers: z.record(z.string()).optional(),
      cookies: z.array(CookieSchema).optional(),
      viewport: ViewportSchema.optional(),
    });
    
    export type ContentRequest = z.infer<typeof ContentRequestSchema>;
  • Alternative simple MCP server handler for 'get_content' using direct axios call to Browserless /content endpoint.
    case 'get_content': {
      if (!args?.url) throw new Error('URL is required');
      const response = await axios.post(`${this.browserlessUrl}/content`, {
        url: args.url,
        ...(args.waitForSelector ? { waitForSelector: args.waitForSelector } : {}),
      }, { timeout: 15000 });
    
      return {
        content: [
          {
            type: 'text',
            text: `Content extracted successfully from ${args.url}`,
          },
          {
            type: 'text',
            text: response.data,
          },
        ],
      };
    }
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 states the tool extracts rendered HTML, implying it performs a read operation, but lacks details on permissions, rate limits, error handling, or output format. This is inadequate for a tool with complex parameters and no output schema.

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 directly states the tool's function without unnecessary words. It's front-loaded and easy to parse, making it highly concise and well-structured for quick understanding.

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 tool's complexity (3 parameters with nested objects, no output schema, and no annotations), the description is insufficient. It doesn't cover parameter meanings, behavioral traits like execution constraints, or output details, leaving significant gaps for an AI agent to use the tool effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate for undocumented parameters. It mentions 'rendered HTML content from a webpage,' which hints at the 'url' parameter but doesn't explain 'waitForSelector' or 'waitForFunction' or their purposes. This leaves key parameters semantically unclear, failing to add meaningful value beyond the bare schema.

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 ('Extract') and the resource ('rendered HTML content from a webpage'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'export_page' or 'take_screenshot', which might also involve webpage content extraction, so it falls short of 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 alternatives. It doesn't mention prerequisites, such as needing a valid URL or browser context, or compare it to siblings like 'execute_browserql' or 'export_page' for different extraction needs, leaving usage context ambiguous.

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/Lizzard-Solutions/browserless-mcp'

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