Skip to main content
Glama
eva-wanxin-git

Windows Automation MCP Server

take_screenshot_region

Capture a specific rectangular area of your Windows screen by defining coordinates and dimensions, then save the screenshot to a specified path.

Instructions

截取屏幕区域

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
xYesX 坐标
yYesY 坐标
widthYes宽度
heightYes高度
pathNo保存路径(可选)

Implementation Reference

  • The core handler function that executes the region screenshot using PowerShell to capture a specific screen area and save it as PNG.
    async takeScreenshotRegion(x, y, width, height, savePath) {
      try {
        const timestamp = new Date().toISOString().replace(/[:.]/g, '-');
        const fileName = `screenshot-region-${timestamp}.png`;
        const defaultPath = path.join(process.env.USERPROFILE, 'Desktop', fileName);
        const finalPath = savePath || defaultPath;
    
        const script = `
          Add-Type -AssemblyName System.Windows.Forms,System.Drawing
          $bitmap = New-Object System.Drawing.Bitmap ${width}, ${height}
          $graphics = [System.Drawing.Graphics]::FromImage($bitmap)
          $graphics.CopyFromScreen(${x}, ${y}, 0, 0, [System.Drawing.Size]::new(${width}, ${height}))
          $bitmap.Save("${finalPath}", [System.Drawing.Imaging.ImageFormat]::Png)
          $bitmap.Dispose()
          $graphics.Dispose()
        `;
    
        await execAsync(`powershell -Command "${script.replace(/"/g, '\\"')}"`, {
          shell: 'powershell.exe'
        });
    
        await fs.access(finalPath);
    
        return { 
          success: true, 
          path: finalPath, 
          region: { x, y, width, height },
          message: '区域截图已保存' 
        };
      } catch (error) {
        return { success: false, error: error.message };
      }
    }
  • Tool schema definition including name, description, input schema with properties x, y, width, height (required), and optional path.
    {
      name: 'take_screenshot_region',
      description: '截取屏幕区域',
      inputSchema: {
        type: 'object',
        properties: {
          x: { type: 'number', description: 'X 坐标' },
          y: { type: 'number', description: 'Y 坐标' },
          width: { type: 'number', description: '宽度' },
          height: { type: 'number', description: '高度' },
          path: { type: 'string', description: '保存路径(可选)' },
        },
        required: ['x', 'y', 'width', 'height'],
      },
    },
  • Registration of the tool handler in the executeTool switch statement, mapping tool name to the takeScreenshotRegion method.
    case 'take_screenshot_region':
      return await this.takeScreenshotRegion(args.x, args.y, args.width, args.height, args.path);
  • src/server.js:97-102 (registration)
    Tool dispatching logic in handleToolCall that routes tool calls to the appropriate module (ScreenTools) based on canHandle.
    for (const [category, toolModule] of Object.entries(this.tools)) {
      if (toolModule.canHandle(name)) {
        result = await toolModule.executeTool(name, args);
        break;
      }
    }
  • src/server.js:48-48 (registration)
    Instantiation and registration of ScreenTools instance in the server's tools object.
    screen: new ScreenTools(),
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the action but doesn't explain what happens after capture (e.g., saves to a file if 'path' is provided, returns image data, requires user permissions, or has side effects like overwriting files). For a tool with potential system interactions, this is a significant gap.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single phrase '截取屏幕区域', which is extremely concise and front-loaded with the core action. There is no wasted language, making it efficient for quick understanding, though it may be overly terse for completeness.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (involves screen capture and file operations), lack of annotations, and no output schema, the description is incomplete. It doesn't cover behavioral aspects like output format, error handling, or dependencies, leaving gaps for an AI agent to infer usage correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all parameters (x, y, width, height, path). The description adds no additional meaning beyond the schema, such as coordinate system details (e.g., origin at top-left) or path format examples. With high schema coverage, the baseline score of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description '截取屏幕区域' (capture screen region) states the basic action but is vague about specifics. It uses a verb+resource structure but doesn't distinguish from the sibling 'take_screenshot' tool or clarify what 'capture' means (e.g., saves to file, returns image data). The purpose is understandable but lacks precision.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. It doesn't mention the sibling 'take_screenshot' tool (which likely captures the full screen) or 'browser_screenshot' (for browser-specific captures), nor does it specify prerequisites like screen access or file system permissions. Usage is implied but not explicitly defined.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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