Skip to main content
Glama

Windows Automation MCP Server

activate_window

Brings a specified window to the foreground and makes it active using partial or full title matching for Windows automation tasks.

Instructions

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

Input Schema

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

Input Schema (JSON Schema)

{ "properties": { "title": { "description": "窗口标题(支持部分匹配)", "type": "string" } }, "required": [ "title" ], "type": "object" }

Implementation Reference

  • The main handler function that activates the specified window using PowerShell's WScript.Shell.AppActivate method.
    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 }; } }
  • Defines the tool schema including name, description, and input schema requiring a 'title' string parameter.
    { name: 'activate_window', description: '激活指定窗口(通过标题)', inputSchema: { type: 'object', properties: { title: { type: 'string', description: '窗口标题(支持部分匹配)' }, }, required: ['title'], }, },
  • Registers the dispatch from executeTool switch statement to the activateWindow handler.
    case 'activate_window': return await this.activateWindow(args.title);
  • Includes 'activate_window' in the list of supported tools for canHandle method.
    const tools = ['list_windows', 'get_active_window', 'activate_window', 'close_window', 'minimize_window', 'maximize_window'];

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