Skip to main content
Glama

drag

Simulates mouse press-move-release to move sliders, dividers, columns, or transfer items between Swing components, returning updated state after the action.

Instructions

Drag with the mouse like a user: press at the start, move, release at the end. The start is ref (an item by value/row/col, a slider's thumb, a split pane's divider, x/y, or its center; edge=right starts at a cell's or header column's right border, e.g. to resize a column). The end is dx/dy from the start, or toRef with toValue (item text or tree path; a number for a slider value or divider location), toRow/toCol, at=before/on/after, or toX/toY. mode=auto (default) picks: mouse - real mouse events inside the application (pan a map or canvas, move a slider, a divider, a table column; window may be in the background); transfer - drag and drop between components through the application's TransferHandlers (lists, tables, trees, text, drop zones): the source's data is dropped on the target at a real drop location, canImport/importData and the source's exportDone run as for a user, without the operating system's drag and drop; picked for drag-enabled sources; os - the real mouse pointer (window comes to the front; only for drag and drop that needs the operating system). The result says what changed (slider value, divider, column widths, a custom component's picture) or what the drop did. Waits first (up to timeoutMs) until the component is visible, enabled, editable where needed, and not blocked by a modal dialog or busy overlay, so no wait_for is needed for a component that is about to become usable. Returns the new snapshot.

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": {
      "ref": "<ref>"
    },
    "name": "drag"
  }
}

Input Schema

NameRequiredDescriptionDefault
xNoStart x inside ref
yNoStart y inside ref
atNoWhere on the target item to drop (default on)
dxNoMove this far right (negative: left) from the start
dyNoMove this far down (negative: up) from the start
colNo
refYesComponent to start the drag in
rowNo
toXNo
toYNo
edgeNoStart at this border of the item or header column
modeNo
stepsNoNumber of mouse moves (default about one per 12 px)
toColNo
toRefNoComponent to drop on or drag to (default: ref)
toRowNoTarget row/item; the row count means after the last one
valueNoStart on this item (list item text, table cell text, tree path)
actionNoDrag and drop action (default: move if the source allows it; Ctrl means copy)
buttonNo
dialogNoAnswer the modal dialog this action opens with this button (text, or ok/yes/no/cancel); its message is reported. An error if no dialog opens within 3 s
headerNoTable: start on the header of column col (move or, with edge=right, resize it)
toValueNoTarget item text or tree path; a number for a slider value or split pane divider location
toHeaderNoTable: the end is on toRef's header (column toCol)
modifiersNoKeys held during the drag, e.g. Ctrl, Shift
timeoutMsNoHow long to wait for the component to become usable (default 10000)
durationMsNoHow long the moves take (default 300; os 500)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.3/5.0
Behavior5/5

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

No annotations are supplied, so the description carries the full burden and does so: it discloses implicit waiting (up to timeoutMs, with visibility/enabled/editable/modal/busy conditions), side effects on window stacking (mouse may run in the background, os brings the window to front), transfer-handler lifecycle (canImport/importData/exportDone run as for a user), dialog answering with a 3 s error window, and what the result reports.

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?

Front-loaded with the gesture model, then the mode taxonomy, then waits and returns – a sensible order, and the length is largely earned for a 26-parameter tool. However, it is one unbroken paragraph with heavy nested parentheses (especially the mode discussion), which makes it harder to scan than a short bulleted structure would be.

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 high-parameter, annotation-free mutation tool with no output schema, the description is close to complete: start/end specification, mode behavior, implicit waiting, dialog handling, focus side effects, and the shape of the result are all covered. Only a few per-parameter behaviors (steps, durationMs, button/modifiers effects) rely entirely on the schema, and no return-value excerpt is given beyond 'Returns the new snapshot.'

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 73%, so the schema already documents many of the 26 parameters. The description adds genuine meaning for a subset (edge=right for column resize, toRow 'row count means after the last one' style semantics, toValue as number for sliders/dividers, Ctrl means copy for action), but several parameters (steps, durationMs, button, modifiers, timeoutMs) are left to the schema alone, so it neither compensates fully nor is redundant.

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?

Opens with a concrete verb and gesture model: 'Drag with the mouse like a user: press at the start, move, release at the end.' It then names the possible start anchors (value/row/col, slider thumb, split pane divider, x/y, center, edge) and end forms (dx/dy, toRef+toValue, toRow/toCol, at, toX/toY), which is enough to distinguish it from click-type siblings without opening the schema.

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 mode-selection guidance (auto picks mouse for in-app mouse events, transfer for component-to-component DnD via TransferHandlers, os only for OS-level drag and drop), plus the note that no wait_for call is needed because the tool waits for the component to become usable. It stops short of stating when *not* to use drag versus siblings like click, so it is not a full when/when-not treatment.

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