Skip to main content
Glama

Playwright Browserbase MCP Server

by ampcome-mcps
keyboard.ts1.02 kB
import { z } from 'zod'; import { defineTool, type ToolFactory } from './tool.js'; const pressKey: ToolFactory = captureSnapshot => defineTool({ capability: 'core', schema: { name: 'browserbase_press_key', description: 'Press a key on the keyboard', inputSchema: z.object({ key: z.string().describe('Name of the key to press or a character to generate, such as `ArrowLeft` or `a`'), }), }, handle: async (context, params) => { const page = await context.getActivePage(); if (!page) { throw new Error('No active page found for pressKey'); } const code = [ `// Press ${params.key}`, `await page.keyboard.press('${params.key.replace(/'/g, "\\'")}');`, ]; const action = () => page.keyboard.press(params.key); // Changed from tab.page to page return { code, action, captureSnapshot, waitForNetwork: true }; }, }); const captureSnapshotValue = true; export default [ pressKey(captureSnapshotValue), ];

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/ampcome-mcps/browserbase-mcp'

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