get_screen_size
Retrieve the dimensions of your Windows display to ensure proper window placement and content scaling.
Instructions
获取屏幕尺寸
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/mouse-keyboard.js:188-200 (handler)The core handler function implementing get_screen_size tool logic, retrieving screen size via robotjs or fallback default values.getScreenSize() { try { if (this.robotAvailable) { const size = this.robot.getScreenSize(); return { success: true, width: size.width, height: size.height }; } else { // 备用方法:使用 PowerShell return { success: true, width: 1920, height: 1080, note: '使用默认值' }; } } catch (error) { return { success: false, error: error.message }; } }
- src/tools/mouse-keyboard.js:82-89 (schema)Schema definition for the get_screen_size tool, specifying name, description, and empty input schema.{ name: 'get_screen_size', description: '获取屏幕尺寸', inputSchema: { type: 'object', properties: {}, }, },
- src/tools/mouse-keyboard.js:118-119 (registration)Registration and dispatch of get_screen_size in the executeTool method's switch statement.case 'get_screen_size': return this.getScreenSize();
- src/tools/mouse-keyboard.js:94-96 (registration)Tool name registered in the canHandle method's supported tools array.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:100-105 (helper)Helper condition in executeTool allowing get_screen_size to run without robotjs dependency.if (!this.robotAvailable && name !== 'get_screen_size') { return { success: false, error: 'robotjs 未安装。请运行: npm install robotjs(需要 Windows Build Tools)' }; }