sonarr_search_episode
Initiates a search for specific TV episodes by their IDs to locate and download available media from configured indexers.
Instructions
Trigger a search for specific episode(s)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| episodeIds | Yes | Episode ID(s) to search for |
Implementation Reference
- src/index.ts:309-322 (registration)Tool registration: defines the 'sonarr_search_episode' tool with its name, description, and input schema (requires episodeIds array).
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"], }, }, - src/index.ts:1560-1574 (handler)Handler: executes when 'sonarr_search_episode' is called. Extracts episodeIds from args, calls SonarrClient.searchEpisode(), and returns success with commandId.
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), }], }; } - src/arr-client.ts:605-613 (helper)Helper: SonarrClient.searchEpisode() sends a POST to /command with name 'EpisodeSearch' and the provided episodeIds array, triggering the Sonarr API to search for those specific episodes.
async searchEpisode(episodeIds: number[]): Promise<{ id: number }> { return this['request']<{ id: number }>('/command', { method: 'POST', body: JSON.stringify({ name: 'EpisodeSearch', episodeIds, }), }); }