Skip to main content
Glama

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

NameRequiredDescriptionDefault
deviceIdNoThe 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

  • 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', }, ], }; },
  • 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); });

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/marcelmarais/spotify-mcp-server'

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