pilot_press_key
Press keyboard keys like Enter, Tab, or Escape to interact with web pages during browser automation tasks.
Instructions
Press a keyboard key (Enter, Tab, Escape, ArrowDown, Backspace, etc.).
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| key | Yes | Key name (e.g. Enter, Tab, Escape, ArrowDown, Shift+Enter) |
Implementation Reference
- src/tools/interaction.ts:163-173 (handler)The handler function for 'pilot_press_key' which executes the Playwright keyboard press operation.
async ({ key }) => { await bm.ensureBrowser(); try { await bm.getPage().keyboard.press(key); bm.resetFailures(); return { content: [{ type: 'text' as const, text: `Pressed ${key}` }] }; } catch (err) { bm.incrementFailures(); return { content: [{ type: 'text' as const, text: wrapError(err) }], isError: true }; } } - src/tools/interaction.ts:159-174 (registration)The registration of the 'pilot_press_key' tool on the MCP server, including its schema definition.
server.tool( 'pilot_press_key', 'Press a keyboard key (Enter, Tab, Escape, ArrowDown, Backspace, etc.).', { key: z.string().describe('Key name (e.g. Enter, Tab, Escape, ArrowDown, Shift+Enter)') }, async ({ key }) => { await bm.ensureBrowser(); try { await bm.getPage().keyboard.press(key); bm.resetFailures(); return { content: [{ type: 'text' as const, text: `Pressed ${key}` }] }; } catch (err) { bm.incrementFailures(); return { content: [{ type: 'text' as const, text: wrapError(err) }], isError: true }; } } );