Skip to main content
Glama

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
NameRequiredDescriptionDefault
keyYesKey name (e.g. Enter, Tab, Escape, ArrowDown, Shift+Enter)

Implementation Reference

  • 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 };
      }
    }
  • 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 };
        }
      }
    );

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/TacosyHorchata/Pilot'

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