Skip to main content
Glama
eva-wanxin-git

Windows Automation MCP Server

take_screenshot

Capture and save screen images on Windows systems. Specify file path and format (PNG or JPG) for automated screenshot management.

Instructions

截取屏幕截图

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathNo保存路径(可选,默认桌面)
formatNo图片格式(可选,默认 png)

Implementation Reference

  • The handler function that executes the screenshot capture using PowerShell script on Windows, saving to desktop or specified path with optional format.
    async takeScreenshot(savePath, format = 'png') {
      try {
        // 生成文件名
        const timestamp = new Date().toISOString().replace(/[:.]/g, '-');
        const fileName = `screenshot-${timestamp}.${format}`;
        const defaultPath = path.join(process.env.USERPROFILE, 'Desktop', fileName);
        const finalPath = savePath || defaultPath;
    
        // 使用 PowerShell 截图
        const script = `
          Add-Type -AssemblyName System.Windows.Forms,System.Drawing
          $bounds = [System.Windows.Forms.Screen]::PrimaryScreen.Bounds
          $bitmap = New-Object System.Drawing.Bitmap $bounds.Width, $bounds.Height
          $graphics = [System.Drawing.Graphics]::FromImage($bitmap)
          $graphics.CopyFromScreen($bounds.Location, [System.Drawing.Point]::Empty, $bounds.Size)
          $bitmap.Save("${finalPath}", [System.Drawing.Imaging.ImageFormat]::${format === 'jpg' ? 'Jpeg' : 'Png'})
          $bitmap.Dispose()
          $graphics.Dispose()
        `;
    
        await execAsync(`powershell -Command "${script.replace(/"/g, '\\"')}"`, {
          shell: 'powershell.exe'
        });
    
        // 验证文件是否创建
        await fs.access(finalPath);
    
        return { 
          success: true, 
          path: finalPath, 
          format, 
          message: '截图已保存' 
        };
      } catch (error) {
        return { success: false, error: error.message };
      }
    }
  • The tool definition including name, description, and input schema for validation.
    {
      name: 'take_screenshot',
      description: '截取屏幕截图',
      inputSchema: {
        type: 'object',
        properties: {
          path: { type: 'string', description: '保存路径(可选,默认桌面)' },
          format: { type: 'string', enum: ['png', 'jpg'], description: '图片格式(可选,默认 png)' },
        },
      },
    },
  • The executeTool method registers and dispatches 'take_screenshot' to its handler.
    async executeTool(name, args) {
      switch (name) {
        case 'take_screenshot':
          return await this.takeScreenshot(args.path, args.format);
        case 'take_screenshot_region':
          return await this.takeScreenshotRegion(args.x, args.y, args.width, args.height, args.path);
        default:
          throw new Error(`未知工具: ${name}`);
      }
    }
  • Checks if 'take_screenshot' is a handled tool.
    canHandle(toolName) {
      const tools = ['take_screenshot', 'take_screenshot_region'];
      return tools.includes(toolName);
    }
Behavior2/5

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

No annotations are provided, so the description carries full burden. '截取屏幕截图' implies a read-only operation that captures screen content, but it doesn't disclose behavioral aspects like whether it requires permissions, saves files automatically, overwrites existing files, or handles errors. For a tool with system-level access, 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, efficient phrase ('截取屏幕截图') that directly conveys the core action. It's front-loaded with zero redundant information, making it highly concise and well-structured for quick comprehension.

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 no annotations, no output schema, and a tool that performs a system-level operation (screenshot capture), the description is inadequate. It doesn't explain what the tool returns (e.g., file path, success status), error conditions, or dependencies, leaving critical gaps for agent usage.

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%, with both parameters ('path' and 'format') well-documented in the schema. The description adds no parameter-specific information beyond what the schema provides, so it meets the baseline for high schema coverage without compensating value.

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

Purpose4/5

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

The description '截取屏幕截图' (Take screenshot) clearly states the verb ('take') and resource ('screenshot'), making the purpose immediately understandable. However, it doesn't differentiate from sibling 'browser_screenshot' or 'take_screenshot_region', which would require explicit distinction for a perfect score.

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?

The description provides no guidance on when to use this tool versus alternatives like 'browser_screenshot' (for browser-specific screenshots) or 'take_screenshot_region' (for partial screenshots). Without any contextual cues, the agent must infer usage from tool names alone.

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