Skip to main content
Glama
eva-wanxin-git

Windows Automation MCP Server

activate_window

Brings a specified window to the foreground by matching its title, enabling quick switching between open applications on Windows.

Instructions

激活指定窗口(通过标题)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
titleYes窗口标题(支持部分匹配)

Implementation Reference

  • The handler function that implements the activate_window tool logic using PowerShell WScript.Shell to activate the window by title.
    async activateWindow(title) {
      try {
        const script = `
          $wshell = New-Object -ComObject wscript.shell
          $wshell.AppActivate("${title}")
        `;
    
        await execAsync(`powershell -Command "${script}"`, { shell: 'powershell.exe' });
        return { success: true, window: title, message: '窗口已激活' };
      } catch (error) {
        return { success: false, error: error.message };
      }
    }
  • Input schema for the activate_window tool, defining the required 'title' parameter.
    {
      name: 'activate_window',
      description: '激活指定窗口(通过标题)',
      inputSchema: {
        type: 'object',
        properties: {
          title: { type: 'string', description: '窗口标题(支持部分匹配)' },
        },
        required: ['title'],
      },
    },
  • Registration and dispatch logic in the executeTool method that routes 'activate_window' calls to the handler.
    case 'activate_window':
      return await this.activateWindow(args.title);
  • Tool name registration in the canHandle method for capability checking.
    canHandle(toolName) {
      const tools = ['list_windows', 'get_active_window', 'activate_window', 
                     'close_window', 'minimize_window', 'maximize_window'];
      return tools.includes(toolName);
    }

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