Skip to main content
Glama

stop_app

Stop a running Tauri desktop application to manage app lifecycle or end testing sessions. This tool enables automated app control without CDP dependencies.

Instructions

Stop app

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Tool schema definition for stop_app with name, description, and empty input schema
    stop_app: { name: 'stop_app', description: 'Stop app', inputSchema: z.object({}), },
  • Tool handler that calls tauriManager.stop() and returns the result as JSON
    stop_app: async () => { const result = await tauriManager.stop(); return { content: [ { type: 'text' as const, text: JSON.stringify(result, null, 2), }, ], }; },
  • Core implementation of stop() method that terminates the Tauri app process, cleans up sockets, and handles platform-specific process termination
    async stop(): Promise<{ message: string }> { // Clean up socket file (Unix only) if (process.platform !== 'win32') { const socketPath = this.getSocketPath(); if (fs.existsSync(socketPath)) { try { fs.unlinkSync(socketPath); } catch (e) { // Ignore } } } if (!this.process) { return { message: 'App was not running' }; } return new Promise((resolve) => { const proc = this.process!; proc.on('exit', () => { this.process = null; this.status = 'not_running'; this.detectedPipePath = null; this.detectedUnixSocketPath = null; resolve({ message: 'App stopped' }); }); // Send SIGTERM if (process.platform !== 'win32') { // Kill process group on Unix try { process.kill(-proc.pid!, 'SIGTERM'); } catch (e) { proc.kill('SIGTERM'); } } else { // On Windows, kill the app binary first, then the process tree // This ensures the actual Tauri app is terminated even if process tree fails this.cleanupOrphanProcesses(); if (proc.pid) { spawn('taskkill', ['/PID', proc.pid.toString(), '/T', '/F'], { stdio: 'ignore', shell: true, }); } proc.kill('SIGTERM'); } // Force kill after 5 seconds setTimeout(() => { if (this.process === proc) { proc.kill('SIGKILL'); this.cleanupOrphanProcesses(); this.process = null; this.status = 'not_running'; this.detectedPipePath = null; this.detectedUnixSocketPath = null; resolve({ message: 'App force stopped' }); } }, 5000); }); }
  • Tool registration - stop_app is included in the DEFAULT_ESSENTIAL_TOOLS array
    const DEFAULT_ESSENTIAL_TOOLS = [ 'app_status', 'launch_app', 'stop_app', 'snapshot', 'click', 'fill', 'screenshot', 'navigate', ];
  • Helper method cleanupOrphanProcesses() that handles killing orphaned Tauri app processes by binary name on both Unix and Windows
    private cleanupOrphanProcesses(): void { if (!this.appConfig) return; if (process.platform === 'win32') { // On Windows, try to kill by binary name try { spawn('taskkill', ['/IM', `${this.appConfig.binaryName}.exe`, '/F'], { stdio: 'ignore', shell: true, }); } catch (e) { // Ignore errors } } else { try { // Kill by binary name spawn('pkill', ['-9', this.appConfig.binaryName], { stdio: 'ignore' }); // Kill tauri dev processes for this directory const pattern = `tauri dev.*${this.appConfig.appDir.replace(/\//g, '\\/')}`; spawn('pkill', ['-9', '-f', pattern], { stdio: 'ignore' }); } catch (e) { // Ignore errors } } }

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/DaveDev42/tauri-plugin-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server