Skip to main content
Glama

execute_browserql

Execute GraphQL queries for browser automation tasks like web scraping, content extraction, and performance audits using Browserless.io.

Instructions

Execute BrowserQL GraphQL queries

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes
variablesNo

Implementation Reference

  • MCP CallToolRequest handler for 'execute_browserql' that validates arguments, calls BrowserlessClient.executeBrowserQL, and formats the response as MCP content.
    case 'execute_browserql': { if (!args) throw new Error('Arguments are required'); const result = await this.client!.executeBrowserQL(args as any); if (result.success && result.data) { return { content: [ { type: 'text', text: 'BrowserQL query executed successfully.', }, { type: 'text', text: JSON.stringify(result.data, null, 2), }, ], }; } else { throw new Error(result.error || 'Failed to execute BrowserQL query'); } }
  • BrowserlessClient method implementing the core logic: sends POST request to Browserless /chromium/bql endpoint with the BrowserQL query and variables.
    async executeBrowserQL(request: BrowserQLRequest): Promise<BrowserlessResponse<BrowserQLResponse>> { try { const response: AxiosResponse<BrowserQLResponse> = await this.httpClient.post('/chromium/bql', request); return { success: true, data: response.data, }; } catch (error) { return this.handleError(error); } }
  • src/index.ts:206-217 (registration)
    Tool registration in ListToolsRequestHandler, defining name, description, and input schema for execute_browserql.
    { name: 'execute_browserql', description: 'Execute BrowserQL GraphQL queries', inputSchema: { type: 'object', properties: { query: { type: 'string' }, variables: { type: 'object' }, }, required: ['query'], }, },
  • Zod schema and TypeScript type definition for BrowserQLRequest (input validation).
    export const BrowserQLRequestSchema = z.object({ query: z.string(), variables: z.record(z.any()).optional(), }); export type BrowserQLRequest = z.infer<typeof BrowserQLRequestSchema>;
  • TypeScript interface for BrowserQLResponse (output type).
    export interface BrowserQLResponse { data: any; errors?: any[]; }

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