Skip to main content
Glama
eva-wanxin-git

Windows Automation MCP Server

move_mouse

Move the mouse cursor to specific screen coordinates (X and Y positions) to automate pointer positioning in Windows applications.

Instructions

移动鼠标到指定位置

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
xYesX 坐标
yYesY 坐标
smoothNo是否平滑移动(可选)

Implementation Reference

  • The primary handler function that executes the mouse movement logic using robotjs, supporting smooth or direct movement.
    moveMouse(x, y, smooth = false) {
      try {
        if (smooth) {
          this.robot.moveMouseSmooth(x, y);
        } else {
          this.robot.moveMouse(x, y);
        }
        return { success: true, position: { x, y }, message: '鼠标已移动' };
      } catch (error) {
        return { success: false, error: error.message };
      }
    }
  • Tool definition including name, description, and input schema for validating arguments x, y, and optional smooth.
    {
      name: 'move_mouse',
      description: '移动鼠标到指定位置',
      inputSchema: {
        type: 'object',
        properties: {
          x: { type: 'number', description: 'X 坐标' },
          y: { type: 'number', description: 'Y 坐标' },
          smooth: { type: 'boolean', description: '是否平滑移动(可选)' },
        },
        required: ['x', 'y'],
      },
    },
  • Registers 'move_mouse' as a supported tool by including it in the canHandle check list.
    canHandle(toolName) {
      const tools = ['move_mouse', 'mouse_click', 'type_text', 'press_key', 
                     'get_mouse_position', 'get_screen_size'];
      return tools.includes(toolName);
    }
  • Dispatch in executeTool method that routes 'move_mouse' calls to the moveMouse handler.
    case 'move_mouse':
      return this.moveMouse(args.x, args.y, args.smooth);
  • Primary registration point where the tool definitions are provided for the MCP protocol.
    getToolDefinitions() {
      return [
        {
          name: 'move_mouse',
          description: '移动鼠标到指定位置',
          inputSchema: {
            type: 'object',
            properties: {
              x: { type: 'number', description: 'X 坐标' },
              y: { type: 'number', description: 'Y 坐标' },
              smooth: { type: 'boolean', description: '是否平滑移动(可选)' },
            },
            required: ['x', 'y'],
          },
        },
        {
          name: 'mouse_click',
          description: '鼠标点击',
          inputSchema: {
            type: 'object',
            properties: {
              button: { type: 'string', enum: ['left', 'right', 'middle'], description: '按钮类型' },
              double: { type: 'boolean', description: '是否双击(可选)' },
            },
          },
        },
        {
          name: 'type_text',
          description: '输入文本',
          inputSchema: {
            type: 'object',
            properties: {
              text: { type: 'string', description: '要输入的文本' },
              delay: { type: 'number', description: '每个字符之间的延迟(毫秒,可选)' },
            },
            required: ['text'],
          },
        },
        {
          name: 'press_key',
          description: '按下键盘按键',
          inputSchema: {
            type: 'object',
            properties: {
              key: { type: 'string', description: '按键名称(如 enter, tab, escape)' },
              modifiers: { type: 'array', items: { type: 'string' }, description: '修饰键(如 control, shift, alt)' },
            },
            required: ['key'],
          },
        },
        {
          name: 'get_mouse_position',
          description: '获取当前鼠标位置',
          inputSchema: {
            type: 'object',
            properties: {},
          },
        },
        {
          name: 'get_screen_size',
          description: '获取屏幕尺寸',
          inputSchema: {
            type: 'object',
            properties: {},
          },
        },
      ];
    }

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/eva-wanxin-git/windows-automation-mcp'

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