browser_drag
Drags browser elements from one location to another, enabling interactions with sliders, sortable lists, and draggable components.
Instructions
browser drag
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "browser_drag"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/browser_tools.js:328-362 (handler)The main handler function browserDrag that executes drag-and-drop logic using Playwright's page.dragAndDrop() method. It accepts startElement, startRef, endElement, endRef parameters, validates refs, calls dragAndDrop with a timeout, and returns success/error response.
/** * Drag and drop between elements */ async function browserDrag(startElement, startRef, endElement, endRef) { try { if (!startRef || !endRef) { return { success: false, message: 'Both start and end element references are required' }; } const page = await getPage(); await page.dragAndDrop(startRef, endRef, { timeout: config.timeout }); return { success: true, message: `Dragged from ${startElement} to ${endElement}`, startElement, startRef, endElement, endRef }; } catch (error) { logger.error(`Error dragging: ${error.message}`); return { success: false, message: error.message }; } } - src/mcp/server.js:280-280 (handler)The tools/call switch case that dispatches 'browser_drag' to the browserDrag function, passing args.startElement, args.startRef, args.endElement, args.endRef.
case 'browser_drag': data = await browserTools.browserDrag(args.startElement, args.startRef, args.endElement, args.endRef); break; - src/mcp/server.js:128-128 (registration)Registration of 'browser_drag' tool in the browserExtras array within the tools/list handler, providing its name and auto-generated description.
{ n:'browser_navigate_back' }, { n:'browser_navigate_forward' }, { n:'browser_hover' }, { n:'browser_drag' }, - src/tools/browser_tools.js:1137-1137 (registration)Export of the browserDrag function from the browser_tools module, making it available for use in server.js.
browserDrag,