Skip to main content
Glama
jomon003

PlayMCP Browser Automation Server

by jomon003

dragAndDrop

Move elements between locations in web interfaces by specifying source and target selectors for automated browser interactions.

Instructions

Drag and drop from one element to another

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sourceSelectorYes
targetSelectorYes

Implementation Reference

  • The core implementation of the dragAndDrop tool, using Playwright locators to drag from sourceSelector to targetSelector.
    async dragAndDrop(sourceSelector: string, targetSelector: string): Promise<void> {
      try {
        if (!this.isInitialized() || !this.state.page) {
          throw new Error('Browser not initialized');
        }
        this.log('Performing drag and drop', { sourceSelector, targetSelector });
        const sourceLocator = this.state.page.locator(sourceSelector);
        const targetLocator = this.state.page.locator(targetSelector);
        await sourceLocator.dragTo(targetLocator);
        this.log('Drag and drop complete');
      } catch (error: any) {
        console.error('Drag and drop error:', error);
        throw new BrowserError('Failed to drag and drop', 'Check if both selectors exist and are interactable');
      }
    }
  • The input schema and metadata definition for the dragAndDrop tool.
    const DRAG_AND_DROP_TOOL: Tool = {
      name: "dragAndDrop",
      description: "Drag and drop from one element to another",
      inputSchema: {
        type: "object",
        properties: {
          sourceSelector: { type: "string" },
          targetSelector: { type: "string" }
        },
        required: ["sourceSelector", "targetSelector"]
      }
    };
  • src/server.ts:537-537 (registration)
    Registration of the dragAndDrop tool in the tools dictionary provided to the MCP server.
    dragAndDrop: DRAG_AND_DROP_TOOL,
  • The dispatch logic in the MCP callTool handler that validates parameters and invokes the controller's dragAndDrop method.
    case 'dragAndDrop': {
      if (!args.sourceSelector || !args.targetSelector) {
        return {
          content: [{ type: "text", text: "Source and target selectors are required" }],
          isError: true
        };
      }
      await playwrightController.dragAndDrop(args.sourceSelector as string, args.targetSelector as string);
      return {
        content: [{ type: "text", text: "Drag and drop completed successfully" }]
      };
    }
Behavior1/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 of behavioral disclosure. However, it only states the action without explaining critical behaviors: whether this requires a browser session, what happens on failure (e.g., if elements aren't found), if it triggers page reloads, or any side effects like visual feedback. For a tool that likely interacts with a UI, this lack of detail is a significant gap.

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 extremely concise with a single sentence that directly states the action. There is no wasted verbiage or unnecessary elaboration, making it front-loaded and easy to parse quickly. However, this conciseness comes at the cost of completeness, as noted in other dimensions.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness1/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of a drag-and-drop operation in a likely browser automation context, with no annotations, no output schema, and low schema coverage, the description is severely incomplete. It doesn't cover the tool's behavior, error handling, dependencies (e.g., open browser), or return values, making it inadequate for safe and effective use by an AI agent.

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

Parameters2/5

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

The input schema has 2 parameters with 0% description coverage, so the description must compensate. It implies parameters for source and target elements ('from one element to another'), but doesn't explain what 'sourceSelector' and 'targetSelector' represent (e.g., CSS selectors, XPaths), their format, or examples. This adds minimal value beyond the schema's property names, leaving parameters largely undocumented.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose2/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Drag and drop from one element to another' is a tautology that essentially restates the tool name 'dragAndDrop' without adding meaningful specificity. It mentions the action but doesn't clarify what type of elements are involved (e.g., UI elements in a browser context) or what the outcome is (e.g., reordering, moving files). Compared to sibling tools like 'mouseDrag' or 'click', it doesn't clearly differentiate its unique function beyond the basic name.

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

Usage Guidelines1/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing an open browser), exclusions (e.g., not working on certain elements), or compare it to similar tools like 'mouseDrag' or 'selectOption'. Without any context, an agent must infer usage from the name alone, which is insufficient for effective tool selection.

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/jomon003/PlayMCP'

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