get_current_playing
Retrieve details about the currently playing Spotify track, including title, artist, and playback status.
Instructions
Get information about the currently playing track
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/playback.ts:66-88 (handler)The core handler function that fetches the currently playing track using SpotifyClient.getCurrentlyPlaying() and returns formatted track info or no-playing status.export async function getCurrentPlaying(client: SpotifyClient) { const track = await client.getCurrentlyPlaying(); if (!track) { return { success: true, playing: false, message: 'No track currently playing', }; } return { success: true, playing: track.isPlaying, track: { name: track.name, artist: track.artist, album: track.album, uri: track.uri, progressMs: track.progressMs, }, }; }
- src/server.ts:170-177 (registration)Tool registration entry in the ListToolsRequestSchema handler, defining the tool name, description, and empty input schema.{ name: 'get_current_playing', description: 'Get information about the currently playing track', inputSchema: { type: 'object', properties: {}, }, },
- src/server.ts:352-361 (handler)MCP server dispatch in CallToolRequestSchema switch statement that calls the getCurrentPlaying handler and formats the response as MCP content.case 'get_current_playing': const currentResult = await playbackTools.getCurrentPlaying(client); return { content: [ { type: 'text', text: JSON.stringify(currentResult, null, 2), }, ], };
- src/server.ts:173-176 (schema)Input schema definition for the tool (empty object, no parameters required).inputSchema: { type: 'object', properties: {}, },
- src/server.ts:14-14 (helper)Import of playbackTools module containing the getCurrentPlaying function.import * as playbackTools from './tools/playback.js';