Skip to main content
Glama

pilot_press_key

Press keyboard keys or key combinations on web pages to interact with forms, navigate fields, close modals, or execute shortcuts.

Instructions

Press a keyboard key or key combination on the page. Use when the user wants to press Enter to submit a form, Tab to move between fields, Escape to close a modal, ArrowDown to navigate a list, or use any keyboard shortcut.

Parameters:

  • key: Key name or combination (e.g., "Enter", "Tab", "Escape", "ArrowDown", "Backspace", "Shift+Enter", "Control+a")

Returns: Confirmation of the key pressed.

Errors:

  • "Unknown key": The key name is not recognized. Use standard Playwright key names (see docs.playwright.dev/key-input).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keyYesKey name (e.g. Enter, Tab, Escape, ArrowDown, Shift+Enter)

Implementation Reference

  • The handler function for the pilot_press_key tool. It uses Playwright's keyboard.press() to send a key press to the page, or sends a 'press' command via the browser extension if one is active.
      server.tool(
        'pilot_press_key',
        `Press a keyboard key or key combination on the page.
    Use when the user wants to press Enter to submit a form, Tab to move between fields, Escape to close a modal, ArrowDown to navigate a list, or use any keyboard shortcut.
    
    Parameters:
    - key: Key name or combination (e.g., "Enter", "Tab", "Escape", "ArrowDown", "Backspace", "Shift+Enter", "Control+a")
    
    Returns: Confirmation of the key pressed.
    
    Errors:
    - "Unknown key": The key name is not recognized. Use standard Playwright key names (see docs.playwright.dev/key-input).`,
          { key: z.string().describe('Key name (e.g. Enter, Tab, Escape, ArrowDown, Shift+Enter)') },
        async ({ key }) => {
          await bm.ensureBrowser();
          try {
            const ext = bm.getExtension();
            if (ext) {
              await bm.extSend('press', { key });
              bm.resetFailures();
              return { content: [{ type: 'text' as const, text: `Pressed ${key}` }] };
            }
            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 entry point. registerAllTools calls registerInteractionTools, which contains the tool definition.
    export function registerAllTools(server: McpServer, bm: BrowserManager, profile: ToolProfile = 'full'): void {
      const allowed = PROFILE_TOOLS[profile];
      const effectiveServer = allowed ? createFilteredServer(server, allowed) : server;
    
      registerNavigationTools(effectiveServer, bm);
      registerSnapshotTools(effectiveServer, bm);
      registerInteractionTools(effectiveServer, bm);
      registerPageTools(effectiveServer, bm);
      registerInspectionTools(effectiveServer, bm);
      registerVisualTools(effectiveServer, bm);
      registerTabTools(effectiveServer, bm);
      registerSettingsTools(effectiveServer, bm);
      registerIframeTools(effectiveServer, bm);
      registerAutomationTools(effectiveServer, bm);
    }
  • pilot_press_key is registered as part of the CORE_TOOLS set, making it available in all profiles (core, standard, full).
    const CORE_TOOLS = new Set([
      'pilot_navigate',
      'pilot_snapshot',
      'pilot_snapshot_diff',
      'pilot_click',
      'pilot_fill',
      'pilot_type',
      'pilot_press_key',
      'pilot_wait',
      'pilot_screenshot',
    ]);
  • The input schema defines a single required string parameter 'key' for the key name or combination.
    { key: z.string().describe('Key name (e.g. Enter, Tab, Escape, ArrowDown, Shift+Enter)') },
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Describes returns (confirmation) and errors ('Unknown key') with reference to Playwright docs. Since no annotations exist, this covers basic behavior well, though side effects (e.g., form submission) are implied but not explicit.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Concise with clear sections (parameters, returns, errors). Every sentence adds value; appropriately structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given a single parameter, no output schema, and no annotations, the description fully covers purpose, usage, parameters, returns, and errors without gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage 100%, but description adds value by providing examples (e.g., 'Shift+Enter') and explaining error handling, going beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it presses a keyboard key or combination, listing common use cases (Enter, Tab, Escape, etc.) and distinguishing from siblings like pilot_type and pilot_click.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicit examples of when to use (submit form, move fields, close modal) but does not name alternatives; however, the sibling list provides context. Clear guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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