get_mouse_position
Retrieve the current coordinates of the mouse cursor on the screen for automation tasks and system control.
Instructions
获取当前鼠标位置
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "get_mouse_position"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/mouse-keyboard.js:179-186 (handler)The handler function that gets the current mouse position using robotjs.getMousePos() and returns the position.
getMousePosition() { try { const pos = this.robot.getMousePos(); return { success: true, position: { x: pos.x, y: pos.y } }; } catch (error) { return { success: false, error: error.message }; } } - src/tools/mouse-keyboard.js:74-81 (schema)The tool schema definition including name, description, and empty input schema.
{ name: 'get_mouse_position', description: '获取当前鼠标位置', inputSchema: { type: 'object', properties: {}, }, }, - src/tools/mouse-keyboard.js:116-117 (registration)Registration in the executeTool switch statement dispatching to the handler.
case 'get_mouse_position': return this.getMousePosition(); - src/tools/mouse-keyboard.js:94-96 (registration)Tool name listed in canHandle method for checking if this class handles the tool.
const tools = ['move_mouse', 'mouse_click', 'type_text', 'press_key', 'get_mouse_position', 'get_screen_size']; return tools.includes(toolName);