sonarr_get_series
Get TV series from your Sonarr library with pagination and optional title filtering. Use limit and offset to fetch specific pages.
Instructions
Get TV series from Sonarr library with optional pagination and title filtering. Defaults to limit=25 to avoid very large responses. Use offset to fetch additional pages.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum number of series to return (default: 25, max: 100) | |
| offset | No | Number of series to skip before returning results (default: 0) | |
| search | No | Optional case-insensitive title filter |
Implementation Reference
- src/index.ts:209-229 (registration)Tool registration/schema definition for 'sonarr_get_series'. Defines the tool name, description, and inputSchema with optional params: limit (default 25, max 100), offset (default 0), and search (case-insensitive title filter).
name: "sonarr_get_series", description: "Get TV series from Sonarr library with optional pagination and title filtering. Defaults to limit=25 to avoid very large responses. Use offset to fetch additional pages.", inputSchema: { type: "object" as const, properties: { limit: { type: "number", description: "Maximum number of series to return (default: 25, max: 100)", }, offset: { type: "number", description: "Number of series to skip before returning results (default: 0)", }, search: { type: "string", description: "Optional case-insensitive title filter", }, }, required: [], }, }, - src/index.ts:1439-1483 (handler)Handler function for 'sonarr_get_series' tool call. Fetches all series from Sonarr via clients.sonarr.getSeries(), applies optional case-insensitive title filtering, paginates with limit/offset, and returns a JSON response with series details (id, title, year, status, network, seasons, episodes, sizeOnDisk, monitored).
case "sonarr_get_series": { if (!clients.sonarr) throw new Error("Sonarr not configured"); const { limit = 25, offset = 0, search } = args as { limit?: number; offset?: number; search?: string; }; const normalizedLimit = Math.max(1, Math.min(limit, 100)); const normalizedOffset = Math.max(0, offset); const filter = search?.trim().toLowerCase(); const allSeries = await clients.sonarr.getSeries(); const filteredSeries = filter ? allSeries.filter(s => s.title.toLowerCase().includes(filter)) : allSeries; const pagedSeries = filteredSeries.slice(normalizedOffset, normalizedOffset + normalizedLimit); return { content: [{ type: "text", text: JSON.stringify({ total: allSeries.length, filteredCount: filteredSeries.length, returned: pagedSeries.length, offset: normalizedOffset, limit: normalizedLimit, hasMore: normalizedOffset + normalizedLimit < filteredSeries.length, nextOffset: normalizedOffset + normalizedLimit < filteredSeries.length ? normalizedOffset + normalizedLimit : null, search: search ?? null, series: pagedSeries.map(s => ({ id: s.id, title: s.title, year: s.year, status: s.status, network: s.network, seasons: s.statistics?.seasonCount, episodes: s.statistics?.episodeFileCount + '/' + s.statistics?.totalEpisodeCount, sizeOnDisk: formatBytes(s.statistics?.sizeOnDisk || 0), monitored: s.monitored, })), }, null, 2), }], }; } - src/arr-client.ts:543-545 (helper)Helper method `getSeries()` in SonarrClient class. Makes the actual API call to GET /api/v3/series to retrieve all series from Sonarr. Returns an array of Series objects.
async getSeries(): Promise<Series[]> { return this['request']<Series[]>('/series'); } - src/arr-client.ts:49-85 (schema)TypeScript interface `Series` defining the shape of series data returned by the Sonarr API, used by the tool handler to shape the response.
export interface Series { id: number; title: string; sortTitle: string; status: string; overview: string; network: string; airTime: string; images: Array<{ coverType: string; url: string }>; seasons: Array<{ seasonNumber: number; monitored: boolean }>; year: number; path: string; qualityProfileId: number; seasonFolder: boolean; monitored: boolean; runtime: number; tvdbId: number; tvRageId: number; tvMazeId: number; firstAired: string; seriesType: string; cleanTitle: string; imdbId: string; titleSlug: string; genres: string[]; tags: number[]; added: string; ratings: { votes: number; value: number }; statistics: { seasonCount: number; episodeFileCount: number; episodeCount: number; totalEpisodeCount: number; sizeOnDisk: number; percentOfEpisodes: number; }; }