sonarr_search
Search for TV series by name, returning the tvdbId needed to add them to Sonarr.
Instructions
Search for TV series by name. Returns results with tvdbId needed for sonarr_add_series.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| term | Yes | Search term (show name) |
Implementation Reference
- src/index.ts:231-243 (schema)Tool schema registration for 'sonarr_search' - defines the input schema requiring a 'term' (show name) string parameter to search TV series in Sonarr.
name: "sonarr_search", description: "Search for TV series by name. Returns results with tvdbId needed for sonarr_add_series.", inputSchema: { type: "object" as const, properties: { term: { type: "string", description: "Search term (show name)", }, }, required: ["term"], }, }, - src/index.ts:1485-1503 (handler)Handler implementation for 'sonarr_search' - validates Sonarr is configured, extracts the 'term' argument, calls clients.sonarr.searchSeries(term), and returns results with title, year, tvdbId, and overview.
case "sonarr_search": { if (!clients.sonarr) throw new Error("Sonarr not configured"); const term = (args as { term: string }).term; const results = await clients.sonarr.searchSeries(term); return { content: [{ type: "text", text: JSON.stringify({ count: results.length, results: results.slice(0, 10).map(r => ({ title: r.title, year: r.year, tvdbId: r.tvdbId, overview: r.overview?.substring(0, 200) + (r.overview && r.overview.length > 200 ? '...' : ''), })), }, null, 2), }], }; } - src/arr-client.ts:557-559 (helper)SonarrClient.searchSeries() - helper method that makes the API call to Sonarr's /series/lookup endpoint to search for TV series by name.
async searchSeries(term: string): Promise<SearchResult[]> { return this['request']<SearchResult[]>(`/series/lookup?term=${encodeURIComponent(term)}`); }