resume_player
Resume paused Spotify playback from where you left off, continuing music after interruptions or when switching devices.
Instructions
Resume paused playback or continue playing from where the user left off.
π― USE CASES: β’ Resume music after phone calls or interruptions β’ Continue playback when returning to apps or devices β’ Implement "play/pause" toggle functionality β’ Resume listening after switching between devices β’ Restore playback state in smart home automations
π WHAT IT RETURNS: β’ Confirmation of resumed playback β’ Current track and position information β’ Updated playback state showing active play β’ Device information where playback resumed β’ Remaining track duration and queue preview
π EXAMPLES: β’ "Resume my music where I left off" β’ "Continue playing on my phone" β’ "Resume the playlist I was listening to" β’ "Start playing again on my smart speaker"
π‘ SMART RESUME: β’ Picks up exactly where playback was paused β’ Maintains queue order and shuffle settings β’ Preserves repeat mode and volume level β’ Can resume on the same or different device
β οΈ REQUIREMENTS: β’ Valid Spotify access token with user-modify-playback-state scope β’ Previous playback session must exist to resume β’ Target device must be available and active
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| token | Yes | Spotify access token for authentication | |
| contextUri | No | ||
| trackUris | No | ||
| deviceId | No | Spotify device ID (optional, uses active device if not specified) |
Implementation Reference
- src/mcp/tools/playback.ts:152-160 (handler)The main handler function for the 'resume_player' MCP tool. It extracts arguments and calls SpotifyService.resumePlayback to resume playback.handler: async (args: any, spotifyService: SpotifyService) => { const { token, contextUri, trackUris, deviceId } = args; return await spotifyService.resumePlayback( token, contextUri, trackUris, deviceId ); },
- src/mcp/tools/playback.ts:140-151 (schema)Zod schema definition for input validation of the 'resume_player' tool.schema: createSchema({ token: commonSchemas.token(), contextUri: z .string() .optional() .describe("Spotify context URI (album, playlist, artist) to play"), trackUris: z .array(z.string()) .optional() .describe("Array of track URIs to play"), deviceId: commonSchemas.deviceId(), }),
- src/mcp/tools/index.ts:22-36 (registration)The 'resume_player' tool is registered by including playbackTools (which contains it) in the allTools registry used by ToolRegistrar for MCP server.export const allTools: ToolsRegistry = { ...albumTools, ...artistTools, ...trackTools, ...playlistTools, ...playbackTools, ...userTools, ...searchTools, };
- src/spotify.ts:665-672 (helper)Helper method in SpotifyService.resumePlayback, which delegates to playMusic for the actual API call.async resumePlayback( token: string, contextUri: string | null = null, trackUris: string | string[] | null = null, deviceId: string | null = null ): Promise<void> { return await this.playMusic(token, trackUris, contextUri, deviceId); }
- src/spotify.ts:630-653 (helper)Core helper method playMusic that makes the Spotify API PUT request to /me/player/play to resume or start playback.async playMusic( token: string, trackUris: string | string[] | null = null, contextUri: string | null = null, deviceId: string | null = null ): Promise<void> { const data: Record<string, any> = {}; if (trackUris) { data.uris = Array.isArray(trackUris) ? trackUris : [`spotify:track:${this.extractId(trackUris)}`]; } if (contextUri) { data.context_uri = contextUri; } const endpoint = deviceId ? `me/player/play?device_id=${deviceId}` : "me/player/play"; return await this.makeRequest<void>(endpoint, token, {}, "PUT", data); }