/** * Navidrome MCP Server - Playback Tool Functions * Copyright (C) 2025 * SPDX-License-Identifier: AGPL-3.0-or-later */ import type { NavidromeClient } from '../client/navidrome-client.js'; import { type AudioDeviceReport, type PlaybackStatus, type QueueEntry, type QueueTrackMetadata } from '../services/playback/playback-engine.js'; import { OUTPUT_MISSING_CODE, type MissingOutputFields } from './missing-audio-output.js'; interface PauseResult { success: boolean; paused?: true; message?: string; } interface ResumeResult { success: boolean; paused?: false; message?: string; code?: typeof OUTPUT_MISSING_CODE; } interface SetVolumeResult { success: true; volume: number; } interface ListAudioDevicesResult extends Omit { output?: string; } type SetAudioDeviceResult = { success: true; device: { id: string; name: string; }; applied: 'now' | 'next-start'; persisted: boolean; } | { success: false; message: string; }; interface PlaySongsResult extends MissingOutputFields { success: true; count: number; skipped?: number; demoted?: true; } interface PlayAlbumsResult extends MissingOutputFields { success: true; albumCount: number; trackCount: number; demoted?: true; } interface PlayAlbumsSearchResult extends MissingOutputFields { success: true; matchCount: number; albumCount: number; trackCount: number; appliedFilters?: Record; demoted?: true; } interface PlaySongsSearchResult extends MissingOutputFields { success: true; count: number; appliedFilters?: Record; demoted?: true; } interface PlayPlaylistResult extends MissingOutputFields { success: true; count: number; demoted?: true; } interface PlaySongSetResult extends MissingOutputFields { success: true; count: number; demoted?: true; } interface NextResult { success: boolean; stopped?: true; message?: string; } interface PreviousResult { success: boolean; message?: string; } interface SeekResult { success: boolean; message?: string; } interface NowPlayingResult { engineRunning: boolean; songId?: string; title?: string; artist?: string; album?: string; position?: number; duration?: number; paused?: boolean; queueIndex?: number; queueLength?: number; isRadio?: boolean; radioStation?: { name: string; }; } interface PlayQueueItem { index: number; songId: string | null; title?: string; artist?: string; album?: string; duration?: number; isCurrent: boolean; isPlaying: boolean; } interface GetPlayQueueResult { items: PlayQueueItem[]; length: number; currentIndex?: number; } interface PlayQueuePageResult extends GetPlayQueueResult { offset: number; limit: number; } interface ClearPlayQueueResult { success: true; } interface ShufflePlayQueueResult { success: boolean; message?: string; } interface ShuffleQueueFromTopResult { success: boolean; message?: string; } interface MoveInPlayQueueResult { success: boolean; noop?: true; message?: string; } interface RemoveFromPlayQueueResult { success: boolean; message?: string; } interface PlayQueueIndexResult { success: boolean; paused?: true; message?: string; } export declare function pause(_args: unknown): Promise; export declare function resume(_args: unknown): Promise; export declare function setVolume(args: unknown): Promise; export declare function listAudioDevices(args: unknown): Promise; export declare function setAudioDevice(args: unknown): Promise; /** * Attaches to an mpv that an exited MCP server left running, so the report reflects it after a * restart. */ export declare function playbackStatus(_args: unknown): Promise; export declare function playSongs(client: NavidromeClient, args: unknown): Promise; export declare function playAlbums(client: NavidromeClient, args: unknown): Promise; export declare function playAlbumsSearch(client: NavidromeClient, args: unknown): Promise; export declare function playSongsSearch(client: NavidromeClient, args: unknown): Promise; export declare function playPlaylist(client: NavidromeClient, args: unknown): Promise; export declare class EmptyLibrarySourceError extends Error { constructor(message: string); } /** * The web remote is the only caller. Every browse source resolves to one row list, so the remote's * two shuffle toggles order every source the same way. `onQueued` receives the loaded songs and * their mpv ids, so the jukebox can label them as the host's. */ export declare function playLibrarySource(client: NavidromeClient, args: unknown, onQueued?: (entryIds: readonly number[], songs: readonly QueueTrackMetadata[]) => void): Promise; export declare function next(_args: unknown): Promise; export declare function previous(_args: unknown): Promise; export declare function seek(args: unknown): Promise; export declare function resetNowPlayingCache(): void; /** * Without `client`, no Navidrome read fills a cold engine cache, and a radio stream reports * "Unknown station". */ export declare function nowPlaying(_args: unknown, client?: NavidromeClient): Promise; export declare function getPlayQueue(client: NavidromeClient, _args: unknown): Promise; /** * Keeps every `QueueEntry` field, such as mpv's entry id, which the web remote's guest view needs. * The model reads the queue only through `toPlayQueueResult`. */ export declare function getPlayQueueEntries(client: NavidromeClient): Promise; export declare function toPlayQueueResult(entries: QueueEntry[]): GetPlayQueueResult; /** * The agent reads one page, since play tools build queues of thousands of tracks. The web remote * reads the entire queue. */ export declare function getPlayQueuePage(client: NavidromeClient, args: unknown): Promise; /** Succeeds with no live mpv, since there is no queue to clear. */ export declare function clearPlayQueue(_args: unknown): Promise; export declare function shufflePlayQueue(_args: unknown): Promise; /** The web remote's shuffle. It never spawns mpv, since a fresh mpv has no queue to shuffle. */ export declare function shuffleQueueFromTop(_args: unknown): Promise; export declare function moveInPlayQueue(args: unknown): Promise; export declare function playQueueIndex(args: unknown): Promise; export declare function removeFromPlayQueue(args: unknown): Promise; export {}; //# sourceMappingURL=playback.d.ts.map