launch_application
Opens Windows applications using file paths or commands, with options to pass arguments and control execution flow.
Instructions
启动应用程序
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | 应用程序路径或命令 | |
| args | No | 命令行参数(可选) | |
| wait | No | 是否等待程序结束(可选) |
Implementation Reference
- src/tools/process.js:81-95 (handler)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 }; } }
- src/tools/process.js:15-23 (schema)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'], },
- src/tools/process.js:12-24 (registration)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'], }, },
- src/tools/process.js:68-69 (handler)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);