lidarr_get_queue
Retrieve the Lidarr download queue with pagination support using limit and offset parameters to manage results.
Instructions
Get Lidarr download queue. Supports pagination with limit and offset.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum number of queue items to return (default: 25, max: 100) | |
| offset | No | Number of queue items to skip before returning results (default: 0) |
Implementation Reference
- src/index.ts:1810-1813 (handler)Handler for lidarr_get_queue tool. Checks if Lidarr is configured, then calls getPaginatedQueue with the Lidarr client and user-provided limit/offset arguments.
case "lidarr_get_queue": { if (!clients.lidarr) throw new Error("Lidarr not configured"); return jsonText(await getPaginatedQueue(clients.lidarr, args as { limit?: number; offset?: number })); } - src/index.ts:1083-1128 (helper)Shared helper function that fetches all pages of the queue from the API client, then applies limit/offset pagination. Returns formatted queue items with progress, status, download client info, and pagination metadata.
type QueueCapableClient = SonarrClient | RadarrClient | LidarrClient; async function getPaginatedQueue( client: QueueCapableClient, args: { limit?: number; offset?: number } | undefined ) { const limit = Math.min(Math.max(Math.floor(args?.limit ?? 25), 1), 100); const offset = Math.max(Math.floor(args?.offset ?? 0), 0); const pageSize = 100; const records = []; let totalRecords = 0; let page = 1; while (true) { const queuePage = await client.getQueue(page, pageSize); totalRecords = queuePage.totalRecords; records.push(...queuePage.records); if (records.length >= totalRecords || queuePage.records.length === 0) { break; } page += 1; } const items = records.slice(offset, offset + limit).map((q) => ({ title: q.title, status: q.status, progress: q.size > 0 ? ((1 - q.sizeleft / q.size) * 100).toFixed(1) + "%" : "unknown", timeLeft: q.timeleft, downloadClient: q.downloadClient, protocol: q.protocol, trackedDownloadStatus: q.trackedDownloadStatus, trackedDownloadState: q.trackedDownloadState, })); return { total: totalRecords, returned: items.length, offset, limit, hasMore: offset + items.length < totalRecords, nextOffset: offset + items.length < totalRecords ? offset + items.length : null, items, }; } - src/index.ts:548-564 (registration)Tool registration for lidarr_get_queue. Defines the tool name, description, and input schema with optional limit (max 100) and offset parameters. Added to TOOLS array when Lidarr client is configured.
name: "lidarr_get_queue", description: "Get Lidarr download queue. Supports pagination with limit and offset.", inputSchema: { type: "object" as const, properties: { limit: { type: "number", description: "Maximum number of queue items to return (default: 25, max: 100)", }, offset: { type: "number", description: "Number of queue items to skip before returning results (default: 0)", }, }, required: [], }, }, - src/arr-client.ts:32-47 (schema)QueueItem interface defining the structure of items returned by the getQueue API call. Fields include title, status, size, progress, download client, protocol, and tracking information.
export interface QueueItem { id: number; title: string; status: string; trackedDownloadStatus: string; trackedDownloadState: string; statusMessages: Array<{ title: string; messages: string[] }>; downloadId: string; protocol: string; downloadClient: string; outputPath: string; sizeleft: number; size: number; timeleft: string; estimatedCompletionTime: string; } - src/arr-client.ts:429-437 (helper)The base ArrClient.getQueue method that calls the */api/v1/queue endpoint. Since LidarrClient extends ArrClient and inherits this, the actual API call for lidarr_get_queue uses this method.
async getQueue(page = 1, pageSize = 100): Promise<{ records: QueueItem[]; totalRecords: number }> { const params = new URLSearchParams({ includeUnknownSeriesItems: "true", includeUnknownMovieItems: "true", page: String(page), pageSize: String(pageSize), }); return this.request<{ records: QueueItem[]; totalRecords: number }>(`/queue?${params.toString()}`); }