get_screen_size
Retrieve current screen resolution and dimensions to help developers and automation scripts adapt interfaces and content layout for Windows display configurations.
Instructions
获取屏幕尺寸
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Input Schema (JSON Schema)
{
"properties": {},
"type": "object"
}
Implementation Reference
- src/tools/mouse-keyboard.js:188-200 (handler)The handler function implementing the logic for the 'get_screen_size' tool. It retrieves screen size using robotjs if available, otherwise uses fallback 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)The tool definition including name, description, and input schema (empty object) for 'get_screen_size'.{ name: 'get_screen_size', description: '获取屏幕尺寸', inputSchema: { type: 'object', properties: {}, }, },
- src/tools/mouse-keyboard.js:118-119 (registration)Registration of the tool handler in the executeTool switch statement, dispatching to getScreenSize().case 'get_screen_size': return this.getScreenSize();
- src/tools/mouse-keyboard.js:93-96 (registration)Tool name registered in the canHandle method's supported tools 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:100-100 (helper)Special handling exemption for 'get_screen_size' when robotjs is not available.if (!this.robotAvailable && name !== 'get_screen_size') {