mouse_move
Moves the mouse cursor to specified X and Y coordinates. Provides clear error feedback when the endpoint is unsupported, ensuring reliable automation.
Instructions
Move mouse cursor via optional /mouse_move endpoint. Returns clear error when endpoint is unsupported.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| x | Yes | Target X coordinate. | |
| y | Yes | Target Y coordinate. |
Implementation Reference
- mcp-server/src/mcp/tools/registration.ts:243-295 (registration)MCP tool registration for 'mouse_move'. Defines the tool name, description, input schema (x,y coordinates as nonnegative ints), and the handler that calls executionService.mouseMove().
server.registerTool( 'mouse_move', { description: 'Move mouse cursor via optional /mouse_move endpoint. Returns clear error when endpoint is unsupported.', inputSchema: { x: z.number().int().nonnegative().describe('Target X coordinate.'), y: z.number().int().nonnegative().describe('Target Y coordinate.'), }, }, async ({ x, y }) => { logInfo('tool.mouse_move.start', { x, y, }); try { const result = await executionService.mouseMove({ x, y, }); logInfo('tool.mouse_move.success', { x, y, status: result.status, }); return { content: [ { type: 'text', text: JSON.stringify( { status: result.status, ok: true, response: result.body, }, null, 2, ), }, ], }; } catch (error) { logError('tool.mouse_move.failure', error, { x, y, }); return toErrorResult(error); } }, ); - Domain service method mouseMove() that delegates to the HotkeylessAhkClient.mouseMove() method.
public async mouseMove(input: MouseMoveRequest): Promise<EndpointActionResult> { return this.client.mouseMove(input); } - mcp-server/src/types.ts:15-18 (schema)TypeScript interface MouseMoveRequest defining the input shape: x (number) and y (number).
export interface MouseMoveRequest { x: number; y: number; } - Infrastructure client method mouseMove() that sends the payload to the optional 'mouse_move' endpoint via tryOptionalEndpoint().
public async mouseMove(payload: MouseMoveRequest): Promise<EndpointActionResult> { return this.tryOptionalEndpoint(payload, 'mouse_move'); } - Helper method tryOptionalEndpoint() which wraps the payload into a TriggerRequest and calls triggerCommand(), used by mouseMove.
private async tryOptionalEndpoint( payload: unknown, endpointName: string, ): Promise<EndpointActionResult> { const obj: TriggerRequest = { command: endpointName, params: payload as Record<string, unknown>, } return this.triggerCommand(obj); }