Skip to main content
Glama

browser_drag

Enable drag-and-drop interactions between specified web elements to test accessibility and functionality during automated WCAG compliance scans using MCP Accessibility Scanner.

Instructions

Perform drag and drop between two elements

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
endElementYesHuman-readable target element description used to obtain the permission to interact with the element
endRefYesExact target element reference from the page snapshot
startElementYesHuman-readable source element description used to obtain the permission to interact with the element
startRefYesExact source element reference from the page snapshot

Implementation Reference

  • Handler function for the browser_drag tool. It resolves locators for the start and end elements from the page snapshot, performs the drag operation using Playwright's dragTo method, waits for completion, and adds the corresponding code snippet to the response.
    handle: async (tab, params, response) => { response.setIncludeSnapshot(); const [startLocator, endLocator] = await tab.refLocators([ { ref: params.startRef, element: params.startElement }, { ref: params.endRef, element: params.endElement }, ]); await tab.waitForCompletion(async () => { await startLocator.dragTo(endLocator); }); response.addCode(`await page.${await generateLocator(startLocator)}.dragTo(page.${await generateLocator(endLocator)});`); },
  • Schema definition for the browser_drag tool, specifying the input parameters for start and end elements (human-readable description and exact ref from snapshot), marked as destructive.
    schema: { name: 'browser_drag', title: 'Drag mouse', description: 'Perform drag and drop between two elements', inputSchema: z.object({ startElement: z.string().describe('Human-readable source element description used to obtain the permission to interact with the element'), startRef: z.string().describe('Exact source element reference from the page snapshot'), endElement: z.string().describe('Human-readable target element description used to obtain the permission to interact with the element'), endRef: z.string().describe('Exact target element reference from the page snapshot'), }), type: 'destructive', },
  • The drag tool (browser_drag) is registered by being included in the default export array of tools from this module.
    export default [ snapshot, click, drag, hover, selectOption, scanPage ];

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/JustasMonkev/mcp-accessibility-scanner'

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