Skip to main content
Glama

drag

Simulate realistic mouse drags in Electron apps using trusted browser events to trigger pointer interactions, CSS states, and React handlers accurately. Includes element movement detection for reliable drag verification.

Instructions

Drag from one point to another using real Chromium input events (via Playwright's CDP mouse pipeline). Because these are trusted browser events, they automatically generate matching PointerEvents — so React onPointerDown, native pointerdown listeners, setPointerCapture, CSS :hover/:active, and every other pointer consumer all see the drag exactly as they would from a real user. Coordinates are CSS pixels. Pass detectSelector to have the driver measure that element before and after the drag and include the movement delta in the result — the only reliable way to catch drags that silently hit a min/max clamp. If the primary strategy does not move the detect target (and a detectSelector was given), the driver automatically falls back to invoking the React handler directly via fiber-prop access and then dispatching move/up events on both document and window. Disable the fallback with fiberFallback: false. The result includes a strategy field indicating which path worked (pointer-capture or react-fiber).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fromYes
toYes
stepsNoIntermediate move steps, default 15.
detectSelectorNoOptional. If provided, the driver reads this element's bounding box before and after the drag and returns the delta so the caller can tell whether anything actually moved.
fiberFallbackNoIf the primary drag strategy fails to move detectSelector, try invoking the React handler directly via fiber-prop access. Default true. Set to false to disable.
Behavior5/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It thoroughly explains the tool's behavior: using trusted browser events via Playwright, generating PointerEvents, measuring movement delta with 'detectSelector', automatic fallback to React fiber-prop access if primary strategy fails, and including a 'strategy' field in results. It also notes coordinate units (CSS pixels) and the ability to disable fallback. This covers critical aspects like mutation effects, reliability mechanisms, and output details.

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

Conciseness3/5

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

The description is front-loaded with the core purpose but becomes dense with technical details about fallback strategies and React handlers. While informative, some sentences could be more streamlined (e.g., the explanation of fallback and result fields is verbose). It efficiently covers key points but could benefit from clearer structuring to separate primary functionality from edge-case handling.

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

Completeness4/5

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

Given the tool's complexity (5 parameters, nested objects, no output schema, no annotations), the description is largely complete. It explains the drag mechanism, parameter purposes, behavioral traits, and result details like 'strategy' field. However, it lacks explicit information on error handling, performance implications (e.g., rate limits), or prerequisites (e.g., browser state), which would enhance completeness for a low-level input simulation tool.

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 description coverage is 60%, and the description adds significant meaning beyond the schema. It explains the purpose of 'detectSelector' (to measure element movement and handle clamps) and 'fiberFallback' (to invoke React handlers directly if primary drag fails), which are only briefly described in the schema. However, it does not elaborate on 'from' and 'to' coordinates or 'steps' beyond what the schema implies, leaving some parameter semantics reliant on 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 explicitly states the tool's purpose: 'Drag from one point to another using real Chromium input events.' It specifies the mechanism (Playwright's CDP mouse pipeline) and distinguishes it from simpler click tools by emphasizing trusted browser events that generate PointerEvents for React/native listeners, CSS states, and pointer consumers. This clearly differentiates it from sibling tools like 'click' or 'hover'.

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?

The description provides clear context for when to use this tool: for drag operations that need to simulate real user input events, especially to trigger PointerEvents and CSS states. It mentions using 'detectSelector' to verify movement and handle clamps, and a fallback strategy for React handlers. However, it does not explicitly state when to choose this over alternatives like manual mouse events or other drag methods, nor does it list specific sibling tools as alternatives.

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/mesomya/electron-driver'

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