execute_browserql
Run GraphQL queries for browser automation tasks, enabling web scraping, performance audits, content extraction, and PDF generation with Browserless.io integration.
Instructions
Execute BrowserQL GraphQL queries
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | ||
| variables | No |
Implementation Reference
- src/client.ts:217-228 (handler)Core implementation of execute_browserql: sends POST request to Browserless /chromium/bql endpoint with 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)MCP tool registration including name, description, and input schema.{ name: 'execute_browserql', description: 'Execute BrowserQL GraphQL queries', inputSchema: { type: 'object', properties: { query: { type: 'string' }, variables: { type: 'object' }, }, required: ['query'], }, },
- src/types.ts:226-231 (schema)Zod schema and TypeScript type definition for BrowserQLRequest (input). Similar schema for BrowserQLResponse interface nearby.export const BrowserQLRequestSchema = z.object({ query: z.string(), variables: z.record(z.any()).optional(), }); export type BrowserQLRequest = z.infer<typeof BrowserQLRequestSchema>;
- src/index.ts:490-509 (handler)MCP server handler for the tool: delegates to client.executeBrowserQL and formats MCP response.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'); } }