Skip to main content
Glama

pilot_drag

Drag an element from a source and drop it onto a target to reorder items or interact with drag-and-drop UI elements.

Instructions

Drag one element and drop it onto another element on the page. Use when the user wants to move an element, reorder items in a drag-and-drop list, or interact with a drag-and-drop UI.

Parameters:

  • start_ref: The source element reference from snapshot (e.g., "@e3") or CSS selector to drag from

  • end_ref: The target element reference from snapshot (e.g., "@e5") or CSS selector to drop onto

Returns: Confirmation with source and target refs.

Errors:

  • "Element not found": Either ref is stale. Run pilot_snapshot to get fresh refs.

  • Timeout (5s): The drag operation could not be completed. The elements may not support drag-and-drop.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
start_refYesSource element ref or CSS selector
end_refYesTarget element ref or CSS selector

Implementation Reference

  • The pilot_drag tool handler — uses startRef and endRef to drag an element onto a target via Playwright's locator.dragTo() with a 5-second timeout. Returns confirmation or error.
      server.tool(
        'pilot_drag',
        `Drag one element and drop it onto another element on the page.
    Use when the user wants to move an element, reorder items in a drag-and-drop list, or interact with a drag-and-drop UI.
    
    Parameters:
    - start_ref: The source element reference from snapshot (e.g., "@e3") or CSS selector to drag from
    - end_ref: The target element reference from snapshot (e.g., "@e5") or CSS selector to drop onto
    
    Returns: Confirmation with source and target refs.
    
    Errors:
    - "Element not found": Either ref is stale. Run pilot_snapshot to get fresh refs.
    - Timeout (5s): The drag operation could not be completed. The elements may not support drag-and-drop.`,
          {
          start_ref: z.string().describe('Source element ref or CSS selector'),
          end_ref: z.string().describe('Target element ref or CSS selector'),
        },
        async ({ start_ref, end_ref }) => {
          await bm.ensureBrowser();
          try {
            const page = bm.getPage();
            const startResolved = await bm.resolveRef(start_ref);
            const endResolved = await bm.resolveRef(end_ref);
    
            const startLocator = 'locator' in startResolved ? startResolved.locator : page.locator(startResolved.selector);
            const endLocator = 'locator' in endResolved ? endResolved.locator : page.locator(endResolved.selector);
    
            await startLocator.dragTo(endLocator, { timeout: 5000 });
            bm.resetFailures();
            return { content: [{ type: 'text' as const, text: `Dragged ${start_ref} → ${end_ref}` }] };
          } catch (err) {
            bm.incrementFailures();
            return { content: [{ type: 'text' as const, text: wrapError(err) }], isError: true };
          }
        }
      );
  • registerAllTools calls registerInteractionTools which registers 'pilot_drag'. The tool is also listed in STANDARD_TOOLS (line 41) so it's available in the 'standard' profile.
    export function registerAllTools(server: McpServer, bm: BrowserManager, profile: ToolProfile = 'full'): void {
      const allowed = PROFILE_TOOLS[profile];
      const effectiveServer = allowed ? createFilteredServer(server, allowed) : server;
    
      registerNavigationTools(effectiveServer, bm);
      registerSnapshotTools(effectiveServer, bm);
      registerInteractionTools(effectiveServer, bm);
      registerPageTools(effectiveServer, bm);
      registerInspectionTools(effectiveServer, bm);
      registerVisualTools(effectiveServer, bm);
      registerTabTools(effectiveServer, bm);
      registerSettingsTools(effectiveServer, bm);
      registerIframeTools(effectiveServer, bm);
      registerAutomationTools(effectiveServer, bm);
  • STANDARD_TOOLS set includes 'pilot_drag' at line 41, meaning it's available in 'standard' and 'full' profiles.
    const STANDARD_TOOLS = new Set([
      ...CORE_TOOLS,
      // navigation
      'pilot_back', 'pilot_forward', 'pilot_reload', 'pilot_get',
      // interaction
      'pilot_hover', 'pilot_select_option', 'pilot_scroll', 'pilot_drag',
      // tabs
      'pilot_tabs', 'pilot_tab_new', 'pilot_tab_close', 'pilot_tab_select',
      // page reading
      'pilot_page_text', 'pilot_page_html',
      // visual
      'pilot_annotated_screenshot',
      // iframe
      'pilot_frames', 'pilot_frame_select', 'pilot_frame_reset',
      // session + config
      'pilot_auth', 'pilot_block', 'pilot_find',
    ]);
Behavior4/5

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

No annotations are provided, so the description carries the full burden. It discloses the drag operation, a 5-second timeout, and error conditions (element not found, timeout). It also notes that elements must support drag-and-drop. This is sufficient for a straightforward action tool.

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?

The description is concise and well-structured: it starts with the action, then usage context, then parameters, returns, and errors. Every sentence adds value without redundancy.

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 simplicity and the presence of a good input schema, the description covers the essential behavior, error handling, and return value. It lacks an output schema, but the stated return type ('Confirmation with source and target refs') is sufficient.

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?

The input schema has 100% coverage with descriptions. The description goes beyond by providing examples of refs ('@e3') and stating that they can be CSS selectors. This adds practical guidance over the schema's basic descriptions.

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 clearly states that the tool drags one element and drops it onto another, using a specific verb and resource. It distinguishes itself from sibling tools like pilot_click or pilot_hover, which involve clicking or hovering rather than drag-and-drop.

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 explicitly says when to use the tool: 'when the user wants to move an element, reorder items in a drag-and-drop list, or interact with a drag-and-drop UI.' It does not specify when not to use it, but the context is clear and helpful.

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/TacosyHorchata/Pilot'

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