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
| Name | Required | Description | Default |
|---|---|---|---|
| x | No | Start x inside ref | |
| y | No | Start y inside ref | |
| at | No | Where on the target item to drop (default on) | |
| dx | No | Move this far right (negative: left) from the start | |
| dy | No | Move this far down (negative: up) from the start | |
| col | No | ||
| ref | Yes | Component to start the drag in | |
| row | No | ||
| toX | No | ||
| toY | No | ||
| edge | No | Start at this border of the item or header column | |
| mode | No | ||
| steps | No | Number of mouse moves (default about one per 12 px) | |
| toCol | No | ||
| toRef | No | Component to drop on or drag to (default: ref) | |
| toRow | No | Target row/item; the row count means after the last one | |
| value | No | Start on this item (list item text, table cell text, tree path) | |
| action | No | Drag and drop action (default: move if the source allows it; Ctrl means copy) | |
| button | No | ||
| dialog | No | Answer 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 | |
| header | No | Table: start on the header of column col (move or, with edge=right, resize it) | |
| toValue | No | Target item text or tree path; a number for a slider value or split pane divider location | |
| toHeader | No | Table: the end is on toRef's header (column toCol) | |
| modifiers | No | Keys held during the drag, e.g. Ctrl, Shift | |
| timeoutMs | No | How long to wait for the component to become usable (default 10000) | |
| durationMs | No | How long the moves take (default 300; os 500) |