itunes_pause
Pause Apple Music playback on macOS. Use this MCP command to temporarily stop music without closing the application.
Instructions
Pause playback in Music (iTunes).
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "itunes_pause"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- mcp_applemusic.py:24-28 (handler)The handler function for the 'itunes_pause' tool, decorated with @mcp.tool() for registration. It runs an AppleScript to pause playback in the Music (iTunes) application.
@mcp.tool() def itunes_pause() -> str: """Pause playback in Music (iTunes).""" script = 'tell application "Music" to pause' return run_applescript(script) - mcp_applemusic.py:5-10 (helper)Supporting utility function that executes AppleScript via subprocess, used by the itunes_pause handler.
def run_applescript(script: str) -> str: """Execute an AppleScript command via osascript and return its output.""" result = subprocess.run(["osascript", "-e", script], capture_output=True, text=True) if result.returncode != 0: return f"Error: {result.stderr.strip()}" return result.stdout.strip()