cancel_sleep_timer
Stop a running sleep timer to continue Spotify playback without interruption. Cancel specific timers or all active ones to maintain your listening session.
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)The core handler function that implements the cancel_sleep_timer tool. It cancels a specific timer by ID or all timers if no ID provided, using the TimerManager.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:176-188 (schema)The input schema definition for the cancel_sleep_timer tool, provided in the MCP listTools response.{ 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:325-337 (registration)The registration/dispatch handler in the MCP CallToolRequest switch statement that invokes the 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), }, ], };