pausePlayback
Pause Spotify playback on a specific device by providing the device ID, enabling remote control of Spotify via the Spotify MCP Server for AI assistants.
Instructions
Pause Spotify playback on the active device
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| deviceId | No | The Spotify device ID to pause playback on |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"deviceId": {
"description": "The Spotify device ID to pause playback on",
"type": "string"
}
},
"type": "object"
}
Implementation Reference
- src/play.ts:87-102 (handler)The main handler function for the pausePlayback tool. It extracts the optional deviceId from args, uses handleSpotifyRequest to call the Spotify API's pausePlayback method, and returns a success message.handler: async (args, _extra: SpotifyHandlerExtra) => { const { deviceId } = args; await handleSpotifyRequest(async (spotifyApi) => { await spotifyApi.player.pausePlayback(deviceId || ''); }); return { content: [ { type: 'text', text: 'Playback paused', }, ], }; },
- src/play.ts:81-86 (schema)The Zod input schema for the pausePlayback tool, defining an optional deviceId string parameter.schema: { deviceId: z .string() .optional() .describe('The Spotify device ID to pause playback on'), },
- src/play.ts:362-371 (registration)The pausePlayback tool is included in the exported playTools array, which collects related Spotify playback control tools.export const playTools = [ playMusic, pausePlayback, skipToNext, skipToPrevious, createPlaylist, addTracksToPlaylist, resumePlayback, addToQueue, ];
- src/index.ts:12-14 (registration)All tools from playTools (including pausePlayback) are registered to the MCP server by calling server.tool() with the tool's name, description, schema, and handler in a loop.[...readTools, ...playTools, ...albumTools].forEach((tool) => { server.tool(tool.name, tool.description, tool.schema, tool.handler); });