restart_claude
Restarts the Claude Desktop application specifically when the MCP Autostarter fails, ensuring uninterrupted workflow and plugin reloading without closing the app.
Instructions
Fully restarts Claude Desktop application (use only if MCP restart fails)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:88-107 (handler)MCP tool handler for 'restart_claude' that delegates to ProcessManager.restartClaudeDesktop() and returns the result as JSON.case 'restart_claude': { try { console.error('Restarting Claude Desktop...'); const result = await processManager.restartClaudeDesktop(); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; } catch (error) { throw new McpError( ErrorCode.InternalError, `Failed to restart Claude Desktop: ${error}` ); } }
- src/index.ts:43-49 (schema)Tool schema definition including name, description, and empty input schema for 'restart_claude'.name: 'restart_claude', description: 'Fully restarts Claude Desktop application (use only if MCP restart fails)', inputSchema: { type: 'object', properties: {}, required: [], },
- src/index.ts:30-62 (registration)Registration of the 'restart_claude' tool in the ListToolsRequestHandler response.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: [ { name: 'restart_mcp', description: 'Intelligently restarts only the MCP handler process without disrupting Claude Desktop UI', inputSchema: { type: 'object', properties: {}, required: [], }, }, { name: 'restart_claude', description: 'Fully restarts Claude Desktop application (use only if MCP restart fails)', inputSchema: { type: 'object', properties: {}, required: [], }, }, { name: 'get_mcp_status', description: 'Check if MCP handler and Claude Desktop processes are running', inputSchema: { type: 'object', properties: {}, required: [], }, }, ], }; });
- src/process-manager.ts:78-123 (helper)Core implementation of restarting Claude Desktop: finds process, kills it, launches new instance based on platform, and verifies restart.async restartClaudeDesktop(): Promise<RestartResult> { try { const claudeProcess = await this.detector.findClaudeDesktopProcess(); if (!claudeProcess) { return { success: false, message: 'Claude Desktop is not running', error: 'CLAUDE_NOT_RUNNING' }; } const oldPid = claudeProcess.pid; // Kill Claude Desktop await this.gracefulKill(claudeProcess.pid); await this.delay(2000); // Restart Claude Desktop based on platform await this.launchClaudeDesktop(); // Wait for it to start const newProcess = await this.waitForClaudeDesktop(10000); if (newProcess) { return { success: true, message: 'Claude Desktop restarted successfully', oldPid, newPid: newProcess.pid }; } else { return { success: false, message: 'Failed to restart Claude Desktop', error: 'CLAUDE_RESTART_FAILED' }; } } catch (error) { return { success: false, message: 'Error restarting Claude Desktop', error: error instanceof Error ? error.message : 'UNKNOWN_ERROR' }; } }