Skip to main content
Glama
BrowserGenie

BrowserGenie MCP Server

by BrowserGenie

long_press

Simulate a long press at element or coordinates to open context menus or initiate text selection.

Instructions

Simulate long-press at coordinates or on an element. Useful for context menus or selection.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
targetYesElement or position to long-press
durationNoPress duration in ms
tabIdNoTarget tab ID (defaults to currently active tab)
apiKeyNoAPI key for authentication if enabled

Implementation Reference

  • The 'long_press' tool handler defined via server.tool(). It accepts a target, duration, tabId, and apiKey, sends a 'long_press' command via WebSocket bridge, and returns the result.
    server.tool(
      'long_press',
      'Simulate long-press at coordinates or on an element. Useful for context menus or selection.',
      {
        target: targetSchema.describe('Element or position to long-press'),
        duration: z.number().optional().default(800).describe('Press duration in ms'),
        tabId: z.number().optional().describe('Target tab ID (defaults to currently active tab)'),
        apiKey: z.string().optional().describe('API key for authentication if enabled'),
      },
      async ({ target, duration, tabId, apiKey }) => {
        const result = await bridge.sendCommand({
          command: 'long_press',
          params: { target, duration },
          tabId,
          apiKey,
          timeout: LONG_TIMEOUT + (duration || 800),
        });
        if (!result.success) {
          return { content: [{ type: 'text', text: `Error: ${result.error?.message}` }], isError: true };
        }
        return { content: [{ type: 'text', text: JSON.stringify(result.data, null, 2) }] };
      }
    );
  • The 'targetSchema' used by long_press (and other gesture tools) for input validation: accepts 'coordinates' (x,y), 'css', or 'xpath' target types.
    const targetSchema = z.object({
      type: z.enum(['coordinates', 'css', 'xpath']).describe('Method to locate: "css" (most reliable), "xpath", or "coordinates"'),
      value: z.union([
        z.string().describe('CSS selector or XPath to element'),
        z.object({
          x: z.number().describe('X coordinate in pixels'),
          y: z.number().describe('Y coordinate in pixels'),
        }).describe('Exact pixel coordinates'),
      ]).describe('The selector string or {x, y} coordinates object'),
    });
  • Input schema for long_press tool: target (required), duration (optional, default 800ms), tabId (optional), apiKey (optional).
    {
      target: targetSchema.describe('Element or position to long-press'),
      duration: z.number().optional().default(800).describe('Press duration in ms'),
      tabId: z.number().optional().describe('Target tab ID (defaults to currently active tab)'),
      apiKey: z.string().optional().describe('API key for authentication if enabled'),
  • 'registerGestureTools(server, bridge)' is called from registerAllTools() to register the long_press tool on the MCP server.
    export function registerAllTools(server: McpServer, bridge: WebSocketBridge) {
      registerNavigationTools(server, bridge);
      registerTabManagementTools(server, bridge);
      registerKeyboardTools(server, bridge);
      registerScreenshotTools(server, bridge);
      registerClickTools(server, bridge);
      registerInputTools(server, bridge);
      registerDragDropTools(server, bridge);
      registerHoverTools(server, bridge);
    
      registerDevtoolsSourcesTools(server, bridge);
      registerDevtoolsModifyTools(server, bridge);
      registerDevtoolsNetworkTools(server, bridge);
      registerDevtoolsStorageTools(server, bridge);
      registerDevtoolsConsoleTools(server, bridge);
    
      registerAccessibilityTools(server, bridge);
      registerEmulationTools(server, bridge);
      registerElementTools(server, bridge);
      registerAuditTools(server, bridge);
      registerInteractionTools(server, bridge);
      registerMonitoringTools(server, bridge);
      registerQaTools(server, bridge);
      registerGestureTools(server, bridge);
      registerMacroTools(server, bridge);
      registerVisualRegressionTools(server, bridge);
    }
  • Import of 'registerGestureTools' from src/tools/gestures.ts.
    import { registerGestureTools } from './gestures.js';
Behavior2/5

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

No annotations are provided, so the description must carry the full burden. It states it simulates a long-press but does not disclose whether it triggers events, waits for UI responses, or has side effects. This lack of behavioral detail is a significant gap.

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

Conciseness5/5

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

The description is a single, concise sentence followed by a brief usage hint. Every word serves a purpose with no redundancy or fluff.

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

Completeness2/5

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

No output schema exists, yet the description does not explain what the tool returns (e.g., success indicator, error handling, or any post-action behavior). For a tool in a complex automation suite, this omission leaves the agent unprepared for expected outcomes.

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

Parameters3/5

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

Schema covers 100% of parameters with descriptions. The tool description adds minimal value beyond the schema, only reiterating that the target can be coordinates or an element. Baseline 3 is appropriate.

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 the action ('simulate long-press'), the target ('at coordinates or on an element'), and the use case ('context menus or selection'), effectively distinguishing it from sibling tools like click_element or double_tap.

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

Usage Guidelines3/5

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

The description mentions the use case ('context menus or selection') but does not explicitly contrast with alternative tools or provide when-not-to-use guidance, leaving usage context implied rather than explicit.

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/BrowserGenie/mcp'

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