Skip to main content
Glama

get_content

Extract rendered HTML content from any webpage by specifying a URL. Optionally wait for specific selectors or JavaScript functions to execute before retrieving the content.

Instructions

Extract rendered HTML content from a webpage

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYes
waitForFunctionNo
waitForSelectorNo

Implementation Reference

  • Core handler logic: sends POST request to Browserless /content endpoint to extract rendered HTML from a URL, handles response and errors.
    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); } }
  • MCP server handler wrapper: calls client.getContent and formats response as MCP content blocks.
    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'); } }
  • src/index.ts:111-134 (registration)
    Tool registration: defines name, description, and input schema in ListToolsRequestHandler response.
    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 validation schema for ContentRequest input type.
    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>;
  • TypeScript interface for ContentResponse output from getContent.
    export interface ContentResponse { html: string; url: string; title: string; }

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

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