Skip to main content
Glama

Windows Automation MCP Server

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

NameRequiredDescriptionDefault

No arguments

Input Schema (JSON Schema)

{ "properties": {}, "type": "object" }

Implementation Reference

  • 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 }; } }
  • The tool definition including name, description, and input schema (empty object) for 'get_screen_size'.
    { name: 'get_screen_size', description: '获取屏幕尺寸', inputSchema: { type: 'object', properties: {}, }, },
  • Registration of the tool handler in the executeTool switch statement, dispatching to getScreenSize().
    case 'get_screen_size': return this.getScreenSize();
  • 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);
  • Special handling exemption for 'get_screen_size' when robotjs is not available.
    if (!this.robotAvailable && name !== 'get_screen_size') {

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/eva-wanxin-git/windows-automation-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server