sonarr_search
Search TheTVDB for TV series by title to add them to Sonarr for automated downloads.
Instructions
Search TheTVDB for new series to add to Sonarr
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Search query (series title) | |
| limit | No | Max results to return (default: 200) |
Implementation Reference
- src/arr/mcp-functions.ts:111-143 (handler)The sonarrSearch method on ArrMCPFunctions class — the actual handler that executes the sonarr_search tool logic. It takes query and optional limit, calls client.searchSeries, and returns mapped results with truncation.
async sonarrSearch(args: { query: string; limit?: number; }): Promise<Record<string, unknown>> { const client = this.ensureSonarr(); const limit = args.limit || ARR_PREVIEW_LIMIT; try { const results = await client.searchSeries(args.query); return { success: true, query: args.query, totalResults: results.length, results: results.slice(0, limit).map((r) => ({ tvdbId: r.tvdbId, title: r.title, year: r.year, status: r.status, network: r.network, runtime: r.runtime, genres: r.genres, certification: r.certification, seasonCount: r.seasons?.length || 0, overview: r.overview ? truncate(r.overview, SUMMARY_PREVIEW_LENGTH) : undefined, })), showing: Math.min(limit, results.length), }; } catch (error) { return { success: false, error: error instanceof Error ? error.message : String(error), }; } } - src/arr/tool-schemas.ts:20-31 (schema)Input schema definition for sonarr_search tool, specifying required 'query' (string) and optional 'limit' (number) parameters with descriptions.
{ name: "sonarr_search", description: "Search TheTVDB for new series to add to Sonarr", inputSchema: { type: "object" as const, properties: { query: { type: "string", description: "Search query (series title)" }, limit: { type: "number", description: "Max results to return (default: 200)", default: 200 }, }, required: ["query"], }, }, - src/arr/tool-registry.ts:18-20 (registration)Registration of sonarr_search tool in ToolRegistry, wiring the schema name to the arrFunctions.sonarrSearch handler.
registry.register("sonarr_search", (args) => arrFunctions.sonarrSearch({ query: args.query as string, limit: args.limit as number | undefined }).then(wrapResponse) ); - src/arr/client.ts:131-136 (helper)The SonarrClient.searchSeries method that performs the actual HTTP GET to /series/lookup?term=... on the Sonarr API.
async searchSeries(query: string): Promise<SonarrSearchResult[]> { const { data } = await this.http.get("/series/lookup", { params: { term: query }, }); return ensureArray(data); } - src/arr/types.ts:143-156 (schema)TypeScript interface SonarrSearchResult defining the shape of data returned from the Sonarr series lookup API.
export interface SonarrSearchResult { tvdbId: number; title: string; overview: string; status: string; images: Array<{ coverType: string; remoteUrl: string }>; seasons: Array<{ seasonNumber: number; monitored: boolean }>; year: number; network: string; runtime: number; genres: string[]; ratings: { votes: number; value: number }; certification: string; }