Skip to main content
Glama

ui_drag

ui_drag

Drag one element onto another using real pointer events to reorder HTML5 lists, kanban cards, or pointer-based sortables during Playwright UI tests.

Instructions

Drag the single element matching from onto the single element matching to with real pointer events: reorders HTML5 drag-and-drop lists, kanban cards and pointer-based sortables. Use the selector values from ui_get_page_state. Selectors containing "nth=" are positional: call ui_get_page_state again after the page changes before reusing them.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "from": "<from>",
      "to": "<to>"
    },
    "name": "ui_drag"
  }
}

Input Schema

NameRequiredDescriptionDefault
toYesCSS selector, or the `selector` value of an element from ui_get_page_state, passed unchanged of the element to drop onto
fromYesCSS selector, or the `selector` value of an element from ui_get_page_state, passed unchanged of the element to pick up
session_idNoWhich open session to act on, as returned by ui_start_session. Optional with one open session; required when several are open.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.2/5.0
Behavior3/5

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

With no annotations, the description carries the full burden; it does disclose that it issues real pointer events and requires a *single* match for each selector, implying ambiguity is not tolerated. It is silent on failure behavior when nothing matches, whether the element is scrolled into view, whether it waits for stability, and how the drag is confirmed or rolled back.

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?

Three compact sentences: action first, then supported drag contexts, then the selector-source and staleness rules. Every sentence carries distinct, non-redundant information with no filler.

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 3-parameter, no-output-schema tool with no annotations, it adequately covers the caller's main risks: selector origin, positional staleness, and single-match expectations. The remaining gap is outcome/failure semantics, which an agent would likely need in order to recover from a failed drag.

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 coverage is 100%, so the baseline is 3; the description goes beyond it by explaining the `from`/`to` selector provenance (values from ui_get_page_state passed unchanged) and the positional-selector staleness hazard tied to `nth=` values. That adds real meaning the schema strings alone do not convey.

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?

Names a specific verb and resource: drag the element matching `from` onto the element matching `to` using real pointer events. It also enumerates concrete use cases (HTML5 drag-and-drop lists, kanban cards, pointer-based sortables), which makes it clearly distinguishable from click/hover siblings.

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?

Gives explicit prerequisites: use the `selector` values returned by ui_get_page_state, and re-call ui_get_page_state before reusing positional (`nth=`) selectors after the page changes. It does not name any alternative drag mechanism or state when not to use it, but the context it does supply is actionable.

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