Skip to main content
Glama

sonarr_get_episodes

Retrieve TV series episodes and identify which are available or missing. Optionally filter by season to check completeness.

Instructions

Get episodes for a TV series. Shows which episodes are available and which are missing.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
seriesIdYesSeries ID to get episodes for
seasonNumberNoOptional: filter to a specific season

Implementation Reference

  • Schema/registration of the sonarr_get_episodes tool: defines the tool name, description, and input schema requiring seriesId (number) with optional seasonNumber (number).
      name: "sonarr_get_episodes",
      description: "Get episodes for a TV series. Shows which episodes are available and which are missing.",
      inputSchema: {
        type: "object" as const,
        properties: {
          seriesId: {
            type: "number",
            description: "Series ID to get episodes for",
          },
          seasonNumber: {
            type: "number",
            description: "Optional: filter to a specific season",
          },
        },
        required: ["seriesId"],
      },
    },
  • Handler for sonarr_get_episodes: extracts seriesId and optional seasonNumber from args, calls SonarrClient.getEpisodes(), and returns episode data (id, seasonNumber, episodeNumber, title, airDate, hasFile, monitored).
    case "sonarr_get_episodes": {
      if (!clients.sonarr) throw new Error("Sonarr not configured");
      const { seriesId, seasonNumber } = args as { seriesId: number; seasonNumber?: number };
      const episodes = await clients.sonarr.getEpisodes(seriesId, seasonNumber);
      return {
        content: [{
          type: "text",
          text: JSON.stringify({
            count: episodes.length,
            episodes: episodes.map(e => ({
              id: e.id,
              seasonNumber: e.seasonNumber,
              episodeNumber: e.episodeNumber,
              title: e.title,
              airDate: e.airDate,
              hasFile: e.hasFile,
              monitored: e.monitored,
            })),
          }, null, 2),
        }],
      };
    }
  • Helper method on SonarrClient: getEpisodes calls the /episode API endpoint with seriesId and optional seasonNumber query parameters, returning typed Episode[] data.
    async getEpisodes(seriesId: number, seasonNumber?: number): Promise<Episode[]> {
      let url = `/episode?seriesId=${seriesId}`;
      if (seasonNumber !== undefined) {
        url += `&seasonNumber=${seasonNumber}`;
      }
      return this['request']<Episode[]>(url);
    }
  • TypeScript interface defining the Episode shape returned by the Sonarr API, used as the return type for getEpisodes.
    export interface Episode {
      id: number;
      seriesId: number;
      tvdbId: number;
      episodeFileId: number;
      seasonNumber: number;
      episodeNumber: number;
      title: string;
      airDate: string;
      airDateUtc: string;
      overview: string;
      hasFile: boolean;
      monitored: boolean;
      absoluteEpisodeNumber: number;
      unverifiedSceneNumbering: boolean;
      episodeFile?: {
        id: number;
        relativePath: string;
        path: string;
        size: number;
        dateAdded: string;
        quality: { quality: { id: number; name: string } };
      };
    }
Behavior4/5

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

With no annotations, the description carries full burden. It discloses that the tool returns availability status (available/missing), which is key behavioral information beyond the input schema. However, it omits details about permissions or other traits.

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?

Two concise sentences with no superfluous information. Well-structured and front-loaded.

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?

The description mentions output behavior (available/missing) but lacks detail on the exact structure returned. For a tool with no output schema, more specifics about fields (e.g., episode numbers, titles) would improve completeness.

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?

Input schema has 100% descriptive coverage for both parameters. The description adds no new parameter information beyond what the schema already provides, 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?

Description clearly states 'Get episodes for a TV series' with a specific verb and resource. It adds value by mentioning available and missing episodes, distinguishing it from sibling tools like sonarr_get_series or sonarr_search_episode.

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 implies usage for retrieving episodes with optional season filter but does not provide explicit when-to-use or alternatives guidance. No mention of when to use search or other tools.

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