Skip to content

システム操作

Issue: #6 システム操作

概要

macOS のシステム設定を AppleScript / シェルコマンドで操作する。

ツール定義

set_volume

python
@mcp.tool()
def set_volume(level: int) -> str:
    """システム音量を設定する (0-100)"""

AppleScript: set volume output volume {level}

get_volume

python
@mcp.tool()
def get_volume() -> str:
    """現在のシステム音量を取得する"""

toggle_dark_mode

python
@mcp.tool()
def toggle_dark_mode() -> str:
    """ダークモードを切り替える"""

AppleScript:

applescript
tell application "System Events"
    tell appearance preferences
        set dark mode to not dark mode
    end tell
end tell

toggle_do_not_disturb

python
@mcp.tool()
def toggle_do_not_disturb() -> str:
    """おやすみモード(集中モード)を切り替える"""

open_app

python
@mcp.tool()
def open_app(app_name: str) -> str:
    """指定したアプリを起動する"""

AppleScript: tell application "{app_name}" to activate

get_battery_status

python
@mcp.tool()
def get_battery_status() -> str:
    """バッテリー残量と充電状態を取得する"""

コマンド: pmset -g batt

send_notification

python
@mcp.tool()
def send_notification(title: str, message: str) -> str:
    """macOS通知を表示する"""

AppleScript:

applescript
display notification "{message}" with title "{title}"