cancel_sleep_timer
Stop an active sleep timer in Spotify to continue playback without interruption. Cancel specific timers or all active ones to maintain continuous music streaming.
Instructions
Cancel an active sleep timer
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| timerId | No | Optional timer ID to cancel specific timer, or omit to cancel all |
Implementation Reference
- src/tools/timer.ts:24-42 (handler)Core implementation of the cancel_sleep_timer tool. Cancels a specific timer by ID or all active timers, returning success status and message.export async function cancelSleepTimer(timerManager: TimerManager, timerId?: string) { if (timerId) { const cancelled = timerManager.cancelTimer(timerId); if (!cancelled) { throw new Error(`Timer ${timerId} not found`); } return { success: true, message: `Timer ${timerId} cancelled`, }; } else { const count = timerManager.cancelAllTimers(); return { success: true, message: `Cancelled ${count} timer(s)`, cancelledCount: count, }; } }
- src/server.ts:192-204 (schema)Defines the tool schema for cancel_sleep_timer, including name, description, and input schema with optional timerId.{ name: 'cancel_sleep_timer', description: 'Cancel an active sleep timer', inputSchema: { type: 'object', properties: { timerId: { type: 'string', description: 'Optional timer ID to cancel specific timer, or omit to cancel all', }, }, }, },
- src/server.ts:377-389 (registration)Registers and dispatches the cancel_sleep_timer tool call by invoking the timerTools.cancelSleepTimer function.case 'cancel_sleep_timer': const cancelResult = await timerTools.cancelSleepTimer( timerManager, args?.timerId as string | undefined ); return { content: [ { type: 'text', text: JSON.stringify(cancelResult, null, 2), }, ], };