player_shuffle
Shuffles the current playlist and starts playback from the first track.
Instructions
Randomly shuffle the current playlist and start playing from the first track.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- index.js:414-418 (schema)Schema definition for the player_shuffle tool: no input parameters required, description explains it shuffles the current playlist and starts playing from the first track.
{ name: "player_shuffle", description: "Randomly shuffle the current playlist and start playing from the first track.", inputSchema: { type: "object", properties: {} }, }, - index.js:616-625 (handler)Handler implementation for player_shuffle. Ensures mpv is running, checks that the playlist has at least 2 tracks, runs 'playlist-shuffle' mpv command, starts playback from index 0, unpauses, and returns confirmation with the track count and current title.
case "player_shuffle": { await ensureMpv(); const count = await getProperty("playlist-count").catch(() => 0); if (!count || count < 2) return fail("Need at least 2 tracks in the playlist to shuffle"); await mpv("playlist-shuffle"); await mpv("playlist-play-index", [0]); await setProperty("pause", false); const title = await getProperty("media-title").catch(() => null); return ok(`Playlist shuffled (${count} tracks). Now playing: ${title || "unknown"}`); } - index.js:724-729 (registration)Tools are registered via ListToolsRequestSchema handler returning the TOOLS array, and invoked via CallToolRequestSchema which dispatches to handleTool with the tool name and args.
server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: TOOLS })); server.setRequestHandler(CallToolRequestSchema, async (request) => { const { name, arguments: args } = request.params; return handleTool(name, args || {}); });