Skip to main content
Glama

initialize_browserless

Establish a connection to a Browserless instance for browser automation, enabling tasks like PDF generation, screenshots, content extraction, and performance audits.

Instructions

Initialize connection to Browserless instance

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
concurrentNo
hostNolocalhost
portNo
protocolNohttp
timeoutNo
tokenYes

Implementation Reference

  • The main handler function for the 'initialize_browserless' tool. It parses the input arguments using BrowserlessConfigSchema, creates a new BrowserlessClient instance with the config, fetches the health status, and returns a success message with the health info.
    case 'initialize_browserless': { const config = BrowserlessConfigSchema.parse(args); this.client = new BrowserlessClient(config); const health = await this.client.getHealth(); return { content: [ { type: 'text', text: `Browserless client initialized successfully. Health status: ${health.data?.status || 'unknown'}`, }, ], }; }
  • src/index.ts:36-50 (registration)
    Registration of the 'initialize_browserless' tool in the list of available tools, including its description and input schema.
    name: 'initialize_browserless', description: 'Initialize connection to Browserless instance', inputSchema: { type: 'object', properties: { host: { type: 'string', default: 'localhost' }, port: { type: 'number', default: 3000 }, token: { type: 'string' }, protocol: { type: 'string', enum: ['http', 'https', 'ws', 'wss'], default: 'http' }, timeout: { type: 'number', default: 30000 }, concurrent: { type: 'number', default: 5 }, }, required: ['token'], }, },
  • Zod schema definition for BrowserlessConfig, used to validate the tool's input arguments in the handler.
    export const BrowserlessConfigSchema = z.object({ host: z.string().default('localhost'), port: z.number().default(3000), token: z.string(), protocol: z.enum(['http', 'https', 'ws', 'wss']).default('http'), timeout: z.number().default(30000), concurrent: z.number().default(5), });
  • Helper guard clause that ensures the browserless client is initialized by calling this tool before other browserless tools.
    if (!this.client && name !== 'initialize_browserless') { throw new Error('Browserless client not initialized. Call initialize_browserless first.');

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