Skip to main content
Glama

itunes_previous

Return to the previous track in Apple Music playback on macOS. Use this tool to navigate backward in your listening queue or playlist.

Instructions

Return to the previous track.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'itunes_previous' tool. It executes an AppleScript command via the run_applescript helper to go to the previous track in the Music (iTunes) application.
    @mcp.tool() def itunes_previous() -> str: """Return to the previous track.""" script = 'tell application "Music" to previous track' return run_applescript(script)
  • Helper function used by itunes_previous (and other tools) to run AppleScript commands using subprocess.
    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()

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/kennethreitz/mcp-applemusic'

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