Skip to main content
Glama
BrowserGenie

BrowserGenie MCP Server

by BrowserGenie

drag_and_drop

Drag elements between locations to interact with sliders, sortable lists, file upload zones, and other drag-interactive components. Simulates human-like drag speed for realistic browser automation.

Instructions

Drag an element from one location to another. Use this for sliders, sortable lists, file upload drop zones, or any drag-interactive elements. Simulates realistic human drag speed.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fromYesSource element/position to start dragging from
toYesTarget element/position to drop onto
tabIdNoTarget tab ID (defaults to active tab)
apiKeyNoAPI key for authentication if enabled

Implementation Reference

  • The registerDragDropTools function registers the 'drag_and_drop' tool on the MCP server. It defines the schema for 'from' and 'to' positions (supporting coordinates, CSS selectors, or XPath), and the handler sends a 'drag_and_drop' command via WebSocketBridge.
    export function registerDragDropTools(server: McpServer, bridge: WebSocketBridge) {
      server.tool(
        'drag_and_drop',
        'Drag an element from one location to another. Use this for sliders, sortable lists, file upload drop zones, or any drag-interactive elements. Simulates realistic human drag speed.',
        {
          from: positionSchema.describe('Source element/position to start dragging from'),
          to: positionSchema.describe('Target element/position to drop onto'),
          tabId: z.number().optional().describe('Target tab ID (defaults to active tab)'),
          apiKey: z.string().optional().describe('API key for authentication if enabled'),
        },
        async ({ from, to, tabId, apiKey }) => {
          const result = await bridge.sendCommand({
            command: 'drag_and_drop',
            params: { from, to },
            tabId,
            apiKey,
          });
          if (!result.success) {
            return { content: [{ type: 'text', text: `Error: ${result.error?.message}` }], isError: true };
          }
          return { content: [{ type: 'text', text: 'Drag and drop completed' }] };
        }
      );
    }
  • The positionSchema Zod schema defines the input validation for source/target positions: a method type ('coordinates', 'css', 'xpath') and a value (string selector or {x,y} coordinates object).
    const positionSchema = 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'),
    });
  • The tool's parameter schema defines 'from' and 'to' positions using positionSchema, plus optional 'tabId' and 'apiKey' parameters.
    server.tool(
      'drag_and_drop',
      'Drag an element from one location to another. Use this for sliders, sortable lists, file upload drop zones, or any drag-interactive elements. Simulates realistic human drag speed.',
      {
        from: positionSchema.describe('Source element/position to start dragging from'),
        to: positionSchema.describe('Target element/position to drop onto'),
        tabId: z.number().optional().describe('Target tab ID (defaults to active tab)'),
        apiKey: z.string().optional().describe('API key for authentication if enabled'),
      },
  • Imports used by the drag-and-drop tool: McpServer from MCP SDK, Zod for validation, and WebSocketBridge for sending commands to the Chrome extension.
    import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
    import { z } from 'zod';
    import { WebSocketBridge } from '../websocket-bridge.js';
  • src/tools/index.ts:9-9 (registration)
    The import line that brings registerDragDropTools into the central tools registry.
    import { registerDragDropTools } from './drag-drop.js';
  • The call to registerDragDropTools(server, bridge) inside registerAllTools, which is invoked from createServer in server.ts.
    registerDragDropTools(server, bridge);
Behavior3/5

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

The description adds 'Simulates realistic human drag speed,' which provides a behavioral trait beyond the schema. However, it lacks details on what happens on failure, whether the tool waits for drop, or any side effects.

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 two sentences, front-loaded with the primary action and examples, with no redundant information. Every sentence adds value.

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

Completeness3/5

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

Given no output schema, the description should ideally mention the return value or success indicator. It does not, so it is slightly incomplete. It adequately covers usage but not the outcome.

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?

The input schema already has 100% coverage with descriptions for all parameters. The description does not add any additional meaning or clarifications beyond what is in the schema, so it meets the baseline.

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 ('drag an element from one location to another') and provides specific use cases (sliders, sortable lists, file upload drop zones), effectively distinguishing it from sibling tools like click_element or hover_element.

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?

It explicitly says 'Use this for...' which gives clear context on when to use the tool. However, it does not mention when not to use it or provide alternatives, but since it's the only drag tool, this is acceptable.

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