vnc_move_mouse
Moves the mouse cursor to specified X and Y coordinates on the remote desktop.
Instructions
Move mouse to specified coordinates
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| x | Yes | X coordinate | |
| y | Yes | Y coordinate |
Implementation Reference
- src/tools/input.ts:50-67 (handler)The handler function that executes the vnc_move_mouse tool logic. It validates coordinates via VncConnectionManager.validateCoordinates, then calls client.sendPointerEvent with button mask 0 (no button pressed) to move the mouse cursor.
export async function handleMoveMouse( vncManager: VncConnectionManager, args: { x: number; y: number } ) { return vncManager.executeWithConnection(async (client) => { // Validate coordinates const coordValidation = vncManager.validateCoordinates(client, args.x, args.y); if (!coordValidation.valid) { throw new Error(coordValidation.error!); } client.sendPointerEvent(args.x, args.y, 0); return { content: [{ type: 'text', text: `Moved mouse to (${args.x}, ${args.y})` }] }; }); } - src/server.ts:139-162 (registration)Registration in the CallToolRequestSchema handler that routes the 'vnc_move_mouse' request to the handleMoveMouse function.
case 'vnc_move_mouse': return await handleMoveMouse(this.vncManager, args as any); case 'vnc_key_press': return await handleKeyPress(this.vncManager, args as any); case 'vnc_type_text': return await handleTypeText(this.vncManager, args as any); case 'vnc_type_multiline': return await handleTypeMultiline(this.vncManager, args as any); case 'vnc_screenshot': return await handleScreenshot(this.vncManager, args as any); default: throw new Error(`Unknown tool: ${name}`); } } catch (error) { return { content: [ { type: 'text', text: `Error: ${error instanceof Error ? error.message : String(error)}` } ] } as any; } }); - src/server.ts:64-73 (schema)The tool schema definition in the ListToolsRequestSchema handler, specifying input parameters (x, y) both required numbers.
name: 'vnc_move_mouse', description: 'Move mouse to specified coordinates', inputSchema: { type: 'object', properties: { x: { type: 'number', description: 'X coordinate' }, y: { type: 'number', description: 'Y coordinate' } }, required: ['x', 'y'] } - src/vnc/client.ts:91-107 (helper)Helper method used by handleMoveMouse to validate that the x/y coordinates are within the VNC screen bounds before moving the mouse.
public validateCoordinates(client: VncClient, x: number, y: number): CoordinateValidation { const screenWidth = client.clientWidth || 0; const screenHeight = client.clientHeight || 0; if (screenWidth === 0 || screenHeight === 0) { return { valid: true }; // Allow if dimensions not yet known } if (x < 0 || x >= screenWidth || y < 0 || y >= screenHeight) { return { valid: false, error: `Coordinates (${x}, ${y}) are outside screen bounds (0, 0) to (${screenWidth - 1}, ${screenHeight - 1})` }; } return { valid: true }; }