Skip to main content
Glama

sonarr_get_queue

Retrieve the Sonarr download queue with pagination. Use limit to control item count and offset to skip results.

Instructions

Get Sonarr download queue. Supports pagination with limit and offset.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMaximum number of queue items to return (default: 25, max: 100)
offsetNoNumber of queue items to skip before returning results (default: 0)

Implementation Reference

  • Handler for sonarr_get_queue tool call. Checks Sonarr is configured, then delegates to the getPaginatedQueue helper function.
    case "sonarr_get_queue": {
      if (!clients.sonarr) throw new Error("Sonarr not configured");
      return jsonText(await getPaginatedQueue(clients.sonarr, args as { limit?: number; offset?: number }));
    }
  • Tool registration/schema definition for sonarr_get_queue with input schema specifying optional limit and offset parameters.
      name: "sonarr_get_queue",
      description: "Get Sonarr 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: [],
      },
    },
  • Helper function that fetches all pages of the queue from the API client, slices based on limit/offset, and formats the response with pagination metadata.
    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,
      };
    }
  • Base API client method on ArrClient that calls the /queue endpoint with pagination parameters. Shared by SonarrClient, RadarrClient, and LidarrClient.
    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()}`);
    }
  • Type definition for queue items returned by the API, used in getQueue and getPaginatedQueue.
    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;
    }
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description must cover behavioral traits. It indicates a read-like operation ('Get') and pagination behavior. However, it lacks details on idempotency, auth requirements, or return format, which is adequate but minimal. A higher score would require more explicit behavioral context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two sentences long, front-loading the core purpose and then adding pagination details. Every word serves a purpose, no fluff. Ideal conciseness.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no output schema, the description could clarify what data is returned (e.g., queue items with status). However, the tool is simple and common in the Sonarr ecosystem. It covers pagination but not the structure or behavior when queue is empty, making it slightly incomplete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% with both 'limit' and 'offset' fully described. The description adds the term 'pagination' and notes default/max values for limit, but these are already in the schema. The added value is marginal, so baseline 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool retrieves the Sonarr download queue, using a specific verb 'Get' and the resource 'download queue'. It distinguishes itself from sibling tools like sonarr_get_calendar or sonarr_get_series by targeting the queue specifically.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description mentions pagination support with limit and offset, giving some usage context. However, it does not specify when to use this tool versus alternatives (e.g., search tools) nor provides explicit when-not-to-use conditions. Only implied usage.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/aplaceforallmystuff/mcp-arr'

If you have feedback or need assistance with the MCP directory API, please join our Discord server