Skip to main content
Glama

sonarr_search_episode

Search for specific TV episodes using their episode IDs to locate and download content through Sonarr media management.

Instructions

Trigger a search for specific episode(s)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
episodeIdsYesEpisode ID(s) to search for

Implementation Reference

  • Core implementation of sonarr_search_episode: Posts 'EpisodeSearch' command to Sonarr API with episode IDs.
    async searchEpisode(episodeIds: number[]): Promise<{ id: number }> {
      return this['request']<{ id: number }>('/command', {
        method: 'POST',
        body: JSON.stringify({
          name: 'EpisodeSearch',
          episodeIds,
        }),
      });
    }
  • src/index.ts:262-275 (registration)
    Tool registration in TOOLS array, including name, description, and input schema definition.
      name: "sonarr_search_episode",
      description: "Trigger a search for specific episode(s)",
      inputSchema: {
        type: "object" as const,
        properties: {
          episodeIds: {
            type: "array",
            items: { type: "number" },
            description: "Episode ID(s) to search for",
          },
        },
        required: ["episodeIds"],
      },
    }
  • MCP server dispatch handler that validates Sonarr config, extracts arguments, calls SonarrClient.searchEpisode, and formats response.
    case "sonarr_search_episode": {
      if (!clients.sonarr) throw new Error("Sonarr not configured");
      const episodeIds = (args as { episodeIds: number[] }).episodeIds;
      const result = await clients.sonarr.searchEpisode(episodeIds);
      return {
        content: [{
          type: "text",
          text: JSON.stringify({
            success: true,
            message: `Search triggered for ${episodeIds.length} episode(s)`,
            commandId: result.id,
          }, null, 2),
        }],
      };
    }

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