launch_app
Start a Tauri desktop application for automated testing using tauri-driver, allowing programmatic interaction with UI elements and application workflows.
Instructions
Launch a Tauri application via tauri-driver. The tauri-driver must be running on the configured port (default: 4444).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| appPath | Yes | Path to the Tauri application binary | |
| args | No | Optional command-line arguments to pass to the application | |
| env | No | Optional environment variables to set for the application |
Input Schema (JSON Schema)
{
"properties": {
"appPath": {
"description": "Path to the Tauri application binary",
"type": "string"
},
"args": {
"description": "Optional command-line arguments to pass to the application",
"items": {
"type": "string"
},
"type": "array"
},
"env": {
"additionalProperties": {
"type": "string"
},
"description": "Optional environment variables to set for the application",
"type": "object"
}
},
"required": [
"appPath"
],
"type": "object"
}
Implementation Reference
- src/tools/launch.ts:11-32 (handler)The main handler function for the 'launch_app' MCP tool. It invokes the TauriDriver's launchApp method, retrieves the app state, and formats the ToolResponse.export async function launchApp( driver: TauriDriver, params: LaunchAppParams ): Promise<ToolResponse<{ message: string; sessionId?: string }>> { try { await driver.launchApp(params); const state = driver.getAppState(); return { success: true, data: { message: `Application launched successfully: ${params.appPath}`, sessionId: state.sessionId, }, }; } catch (error) { return { success: false, error: error instanceof Error ? error.message : String(error), }; } }
- src/index.ts:53-75 (registration)Registration of the 'launch_app' tool in the MCP server's ListTools handler, including name, description, and input schema.name: 'launch_app', description: 'Launch a Tauri application via tauri-driver. The tauri-driver must be running on the configured port (default: 4444).', inputSchema: { type: 'object', properties: { appPath: { type: 'string', description: 'Path to the Tauri application binary', }, args: { type: 'array', items: { type: 'string' }, description: 'Optional command-line arguments to pass to the application', }, env: { type: 'object', additionalProperties: { type: 'string' }, description: 'Optional environment variables to set for the application', }, }, required: ['appPath'], }, },
- src/index.ts:208-218 (registration)Dispatch handler in the MCP server's CallToolRequestSchema that invokes the launchApp tool handler.case 'launch_app': { const result = await launchApp(driver, args as any); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; }
- src/types.ts:42-49 (schema)TypeScript interface defining the input parameters for launching the app, used by the handler.export interface LaunchAppParams { /** Path to the Tauri application binary */ appPath: string; /** Optional additional arguments to pass to the app */ args?: string[]; /** Optional environment variables */ env?: Record<string, string>; }
- src/tauri-driver.ts:33-74 (helper)Core implementation in TauriDriver class that launches the Tauri app using WebDriver remote connection to tauri-driver.async launchApp(params: LaunchAppParams): Promise<void> { if (this.appState.isRunning) { throw new Error('Application is already running. Close it first.'); } const appPath = params.appPath || this.config.appPath; if (!appPath) { throw new Error('Application path is required'); } try { // Ensure screenshot directory exists await fs.mkdir(this.config.screenshotDir, { recursive: true }); // Connect to tauri-driver via WebDriver const browser = await remote({ capabilities: { 'tauri:options': { application: appPath, args: params.args || [], env: params.env || {}, }, } as any, logLevel: 'error', port: this.config.webdriverPort, }); this.appState.browser = browser; this.appState.isRunning = true; this.appState.appPath = appPath; this.appState.sessionId = browser.sessionId; // Set default timeout await browser.setTimeout({ implicit: this.config.defaultTimeout, }); } catch (error) { this.appState.isRunning = false; this.appState.browser = null; throw new Error(`Failed to launch application: ${error instanceof Error ? error.message : String(error)}`); } }