quit_application
Close a specified macOS application through the MCP Mac Apps Server. This tool terminates running apps by name, helping users manage system resources and control active processes.
Instructions
Закрывает указанное приложение
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| appName | Yes | Имя приложения для закрытия |
Implementation Reference
- src/server.py:348-355 (handler)The core handler function that executes the quit_application tool by running an AppleScript command via osascript to quit the specified macOS application.def quit_application(app_name: str) -> str: """Closes application""" apple_script = f'tell application "{app_name}"\nquit\nend tell' apple_script_escaped = apple_script.replace("'", "'\\''") stdout, stderr = exec_command(f"osascript -e '{apple_script_escaped}'") if stderr: raise Exception(f'Failed to close application "{app_name}": {stderr}') return f'Application "{app_name}" closed'
- src/index.ts:475-497 (handler)The core handler method that executes the quit_application tool by running an AppleScript command via osascript to quit the specified macOS application (TypeScript implementation).private async quitApplication(appName: string) { try { const appleScript = ` tell application "${appName}" quit end tell `; await execAsync(`osascript -e '${appleScript.replace(/'/g, "'\\''")}'`); return { content: [ { type: "text", text: `Приложение "${appName}" закрыто`, }, ], }; } catch (error) { throw new Error( `Не удалось закрыть приложение "${appName}": ${error instanceof Error ? error.message : String(error)}` ); }
- src/server.py:86-98 (schema)The input schema definition for the quit_application tool, specifying appName as required string parameter."name": "quit_application", "description": "Closes specified application", "inputSchema": { "type": "object", "properties": { "appName": { "type": "string", "description": "Application name to close", }, }, "required": ["appName"], }, },
- src/index.ts:99-110 (schema)The input schema definition for the quit_application tool (TypeScript version, in Russian).name: "quit_application", description: "Закрывает указанное приложение", inputSchema: { type: "object", properties: { appName: { type: "string", description: "Имя приложения для закрытия", }, }, required: ["appName"], },
- src/server.py:603-604 (registration)The dispatch/registration code in the main request handler that routes tool calls to the quit_application function.elif tool_name == "quit_application": result_text = quit_application(arguments.get("appName"))