Skip to main content
Glama
eva-wanxin-git

Windows Automation MCP Server

launch_application

Opens Windows applications using file paths or commands, with options to pass arguments and control execution flow.

Instructions

启动应用程序

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes应用程序路径或命令
argsNo命令行参数(可选)
waitNo是否等待程序结束(可选)

Implementation Reference

  • The core handler function for the 'launch_application' tool. It constructs a command from the path and args, and either executes it synchronously (if wait=true) using execAsync or asynchronously using spawn.
    async launchApplication(appPath, args = [], wait = false) {
      try {
        const command = args.length > 0 ? `"${appPath}" ${args.join(' ')}` : `"${appPath}"`;
        
        if (wait) {
          const { stdout, stderr } = await execAsync(command);
          return { success: true, path: appPath, output: stdout, error: stderr };
        } else {
          spawn(command, { shell: true, detached: true, stdio: 'ignore' }).unref();
          return { success: true, path: appPath, message: '应用程序已启动' };
        }
      } catch (error) {
        return { success: false, error: error.message };
      }
    }
  • Input schema defining the parameters for the launch_application tool: path (required), args (optional array), wait (optional boolean).
    inputSchema: {
      type: 'object',
      properties: {
        path: { type: 'string', description: '应用程序路径或命令' },
        args: { type: 'array', items: { type: 'string' }, description: '命令行参数(可选)' },
        wait: { type: 'boolean', description: '是否等待程序结束(可选)' },
      },
      required: ['path'],
    },
  • Tool registration in getToolDefinitions(): includes name, description, and input schema for 'launch_application'.
    {
      name: 'launch_application',
      description: '启动应用程序',
      inputSchema: {
        type: 'object',
        properties: {
          path: { type: 'string', description: '应用程序路径或命令' },
          args: { type: 'array', items: { type: 'string' }, description: '命令行参数(可选)' },
          wait: { type: 'boolean', description: '是否等待程序结束(可选)' },
        },
        required: ['path'],
      },
    },
  • Dispatch in executeTool method that routes 'launch_application' calls to the handler.
    case 'launch_application':
      return await this.launchApplication(args.path, args.args, args.wait);

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