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
| Name | Required | Description | Default |
|---|---|---|---|
| x | Yes | X 坐标 | |
| y | Yes | Y 坐标 | |
| smooth | No | 是否平滑移动(可选) |
Implementation Reference
- src/tools/mouse-keyboard.js:125-136 (handler)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 }; } }
- src/tools/mouse-keyboard.js:26-38 (schema)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'], }, },
- src/tools/mouse-keyboard.js:93-97 (registration)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); }
- src/tools/mouse-keyboard.js:108-109 (handler)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);
- src/tools/mouse-keyboard.js:24-91 (registration)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: {}, }, }, ]; }