Skip to main content
Glama

Puppeteer-Extra MCP Server

evaluate.ts920 B
import { mcpServer } from '@/index'; import z from 'zod'; import { getBrowser } from '@/utils/browserManager'; mcpServer.tool( 'puppeteer_evaluate', 'Execute JavaScript in the browser console', { script: z.string().describe('JavaScript code to execute'), }, async ({ script }) => { const browser = getBrowser(); try { const { result, logs } = await browser.evaluate(script); return { content: [ { type: 'text', text: `Execution result:\n${JSON.stringify( result, null, 2, )}\n\nConsole output:\n${logs.join('\n')}`, }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Script execution failed: ${(error as Error).message}`, }, ], isError: true, }; } }, );

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/gpaul-faldin/MCP_puppeteer_extra'

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