tauri_driver_session
Manage automation sessions for Tauri applications by starting, stopping, or checking connection status to enable UI testing and debugging through WebSocket connections.
Instructions
[Tauri Apps Only] Start/stop automation session to connect to a RUNNING Tauri app. Supports multiple concurrent app connections - each app runs on a unique port. The most recently connected app becomes the "default" app used when no appIdentifier is specified. Use action "status" to check connection state: returns single app format when 1 app connected, or array format with "isDefault" indicator when multiple apps connected. Action "stop" without appIdentifier stops ALL sessions; with appIdentifier stops only that app. The identifier field (e.g., "com.example.myapp") uniquely identifies each app. REQUIRED before using other tauri_webview_* or tauri_plugin_* tools. Connects via WebSocket to the MCP Bridge plugin in the Tauri app. For browser automation, use Chrome DevTools MCP instead. For Electron apps, this tool will NOT work.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| action | Yes | Action to perform: start or stop the session, or check status | |
| host | No | Host address to connect to (e.g., 192.168.1.100). Falls back to MCP_BRIDGE_HOST or TAURI_DEV_HOST env vars | |
| port | No | Port to connect to (default: 9223) | |
| appIdentifier | No | App identifier (port number or bundle ID) to stop. Only used with action "stop". If omitted, stops all sessions. |
Implementation Reference
- Core handler function implementing the tauri_driver_session tool logic for starting, stopping, and checking status of Tauri driver sessions.export async function manageDriverSession( action: 'start' | 'stop' | 'status', host?: string, port?: number, appIdentifier?: string | number ): Promise<string> { switch (action) { case 'status': { return handleStatusAction(); } case 'start': { return handleStartAction(host, port); } case 'stop': { return handleStopAction(appIdentifier); } default: { return handleStopAction(appIdentifier); } } }
- Zod schema defining input parameters for the tauri_driver_session tool.export const ManageDriverSessionSchema = z.object({ action: z.enum([ 'start', 'stop', 'status' ]).describe('Action to perform: start or stop the session, or check status'), host: z.string().optional().describe( 'Host address to connect to (e.g., 192.168.1.100). Falls back to MCP_BRIDGE_HOST or TAURI_DEV_HOST env vars' ), port: z.number().optional().describe('Port to connect to (default: 9223)'), appIdentifier: z.union([ z.string(), z.number() ]).optional().describe( 'App identifier (port number or bundle ID) to stop. Only used with action "stop". If omitted, stops all sessions.' ), });
- packages/mcp-server/src/tools-registry.ts:221-249 (registration)Registration of the tauri_driver_session tool in the tools registry, including metadata, schema reference, annotations, and handler wrapper that delegates to the core implementation.{ name: 'tauri_driver_session', description: '[Tauri Apps Only] Start/stop automation session to connect to a RUNNING Tauri app. ' + 'Supports multiple concurrent app connections - each app runs on a unique port. ' + 'The most recently connected app becomes the "default" app used when no appIdentifier is specified. ' + 'Use action "status" to check connection state: returns single app format when 1 app connected, ' + 'or array format with "isDefault" indicator when multiple apps connected. ' + 'Action "stop" without appIdentifier stops ALL sessions; with appIdentifier stops only that app. ' + 'The identifier field (e.g., "com.example.myapp") uniquely identifies each app. ' + 'REQUIRED before using other tauri_webview_* or tauri_plugin_* tools. ' + 'Connects via WebSocket to the MCP Bridge plugin in the Tauri app. ' + 'For browser automation, use Chrome DevTools MCP instead. ' + 'For Electron apps, this tool will NOT work.', category: TOOL_CATEGORIES.UI_AUTOMATION, schema: ManageDriverSessionSchema, annotations: { title: 'Manage Tauri Session', readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false, }, handler: async (args) => { const parsed = ManageDriverSessionSchema.parse(args); return await manageDriverSession(parsed.action, parsed.host, parsed.port, parsed.appIdentifier); }, },