Skip to main content
Glama

drag

Perform mouse-based drag operations for CSS-driven interactions such as adjusting sliders, resizing elements, selecting text, and reordering lists. Specify start and end points via selectors or coordinates.

Instructions

Drag via native CDP mouse events. Works for CSS-driven drag: slider thumbs, resize handles, text selection, mouse-based reorder lists (SortableJS in mouse mode). NOT for the HTML5 Drag&Drop API (draggable=true with dragstart/drop listeners, React DnD HTML5Backend, Vuedraggable, ng2-dnd) — that needs Input.dispatchDragEvent. Source: from_ref/from_selector or from_x+from_y; target: to_ref/to_selector or to_x+to_y.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
to_xNoTarget viewport X in px (with to_y)
to_yNoTarget viewport Y in px
stepsNoNative mouseMoved events between press and release; minimum 5
from_xNoSource viewport X in px (with from_y)
from_yNoSource viewport Y in px
to_refNoTarget element ref
from_refNoSource element ref
to_selectorNoTarget CSS selector
from_selectorNoSource CSS selector

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed11 schema fields changedv2.10.5
    • removedInput schema / $schema
      Removed value: -"http://json-schema.org/draft-07/schema#"
    • removedInput schema / additionalProperties
      Removed value: -false
    • changedInput schema / properties / from_ref / description
      Previous value: -"A11y-Tree source ref (e.g. 'e5')"New value: +"Source element ref"
    • changedInput schema / properties / from_selector / description
      Previous value: -"CSS selector for source element"New value: +"Source CSS selector"
    • changedInput schema / properties / from_x / description
      Previous value: -"Source X coord (viewport px) — alternative zu Ref"New value: +"Source viewport X in px (with from_y)"
    • changedInput schema / properties / from_y / description
      Previous value: -"Source Y coord (viewport px) — alternative zu Ref"New value: +"Source viewport Y in px"
    • changedInput schema / properties / steps / description
      Previous value: -"Anzahl mouseMoved-Events zwischen press und release (min 5 fuer HTML5-dragover)"New value: +"Native mouseMoved events between press and release; minimum 5"
    • changedInput schema / properties / to_ref / description
      Previous value: -"A11y-Tree target ref (e.g. 'e7')"New value: +"Target element ref"
    • changedInput schema / properties / to_selector / description
      Previous value: -"CSS selector for target element"New value: +"Target CSS selector"
    • changedInput schema / properties / to_x / description
      Previous value: -"Target X coord (viewport px)"New value: +"Target viewport X in px (with to_y)"
    • changedInput schema / properties / to_y / description
      Previous value: -"Target Y coord (viewport px)"New value: +"Target viewport Y in px"
  2. First observedv2.7.0

TDQS

A4.5/5.0
Behavior4/5

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

Since no annotations are provided, the description carries the full burden of behavioral disclosure. It reveals the low-level mechanism (native CDP mouse events), the interaction types it can drive, and its exclusions. It stops short of describing side effects like cursor movement or whether the action waits for animations to settle, but it is substantially transparent for a drag operation.

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

Conciseness4/5

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

The description is compact but information-dense. The first sentence states the purpose and supported drag types; the second states exclusions and source/target options. Every clause adds value, though the long list of excluded frameworks is slightly verbose. Still, it is well front-loaded and efficient.

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?

For a tool with 9 parameters, no annotations, and no output schema, the description covers the essential guidance: what it does, what it cannot do, and how to specify source and target. The 'steps' parameter is already documented in the schema. The only minor gap is that it does not mention what happens after the drag completes (e.g., waiting for resulting state), but overall it is sufficiently complete for an agent to invoke it correctly.

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?

All 9 parameters have schema descriptions, so the schema already provides individual meaning. The description adds valuable higher-level semantics by grouping source parameters as 'from_ref/from_selector or from_x+from_y' and target parameters similarly, clarifying exclusive pairings that the schema alone does not express. This meaningfully helps an agent construct valid parameter combinations.

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 opens with a specific verb and resource: 'Drag via native CDP mouse events.' It then enumerates concrete use cases (slider thumbs, resize handles, text selection, mouse-based reorder lists) and explicitly distinguishes itself from the HTML5 Drag&Drop API. This makes the tool's purpose unmistakable and clearly separates it from sibling input tools like click, type, and scroll.

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

Usage Guidelines5/5

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

The description explicitly states when NOT to use this tool ('NOT for the HTML5 Drag&Drop API') and names the alternative mechanism ('that needs Input.dispatchDragEvent'). It also lists the scenarios it DOES support, giving clear conditions for selection. No inference is required to decide whether this tool fits a given drag task.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.