| name | sonarr |
| description | This skill should be used when the user wants to manage TV shows in Sonarr. Triggers include: "add a TV show", "add to Sonarr", "search Sonarr", "find a series", "remove a show", "delete show", "check if show exists", "is [show] in my library", "what's airing this week", "upcoming episodes", "Sonarr library", or any general mention of Sonarr or TV show library management. |
Sonarr TV Show Management Skill
Search and add TV shows to your Sonarr library with support for monitor options, quality profiles, and search-on-add.
Purpose
This skill enables management of your Sonarr TV show library:
- Search for TV shows by name
- Add shows to your library with configurable options
- Check if shows already exist
- Remove shows (with optional file deletion)
- View quality profiles and root folders
Operations include both read and write actions. Always confirm before removing shows with file deletion.
Setup
Credentials are configured in the plugin settings (userConfig). A SessionStart hook writes them to ~/.config/lab-sonarr/config.env, which the scripts load automatically — no manual file editing. Variables used:
SONARR_URL="http://localhost:8989"
SONARR_API_KEY="<your_api_key>"
SONARR_DEFAULT_QUALITY_PROFILE="1"
Configuration variables:
SONARR_URL: Your Sonarr server URL (no trailing slash)
SONARR_API_KEY: API key from Sonarr (Settings → General → API Key)
SONARR_DEFAULT_QUALITY_PROFILE: Quality profile ID (optional, defaults to 1)
Commands
The search-json command returns raw JSON; all other commands return formatted text.
Search for Shows
./scripts/sonarr.sh search "Breaking Bad"
./scripts/sonarr.sh search "The Office"
Output: Numbered list with TVDB IDs, titles, years, and TVDB links.
Search for Shows (raw JSON)
./scripts/sonarr.sh search-json "Breaking Bad"
./scripts/sonarr.sh search-json "The Office"
Output: Raw JSON search results (includes overview and additional metadata).
Check if Show Exists
./scripts/sonarr.sh exists <tvdbId>
Output: Boolean indicating if show is in library.
Add a Show
./scripts/sonarr.sh add <tvdbId>
./scripts/sonarr.sh add <tvdbId> [profileId]
./scripts/sonarr.sh add <tvdbId> [profileId] --no-search
Remove a Show
./scripts/sonarr.sh remove <tvdbId>
./scripts/sonarr.sh remove <tvdbId> --delete-files
Important: Always ask the user if they want to delete files when removing!
Get Configuration
./scripts/sonarr.sh config
Output: Available root folders and quality profiles with their IDs.
Workflow
When the user asks about TV shows:
- "Add Breaking Bad to Sonarr" → Run
search "Breaking Bad", present results with TVDB IDs and links, run exists <tvdbId>, then add <tvdbId> if absent
- "Is The Office in my library?" → Run
search "The Office" to identify the TVDB ID, then exists <tvdbId>
- "Remove Game of Thrones" → Ask about file deletion, then run
remove <tvdbId> with appropriate flag
- "What quality profiles do I have?" → Run
config
Presenting Search Results
Always include TVDB links when presenting search results:
- Format:
[Title (Year)](https://thetvdb.com/dereferrer/series/TVDB_ID)
- Show numbered list for user selection
- Include year, TVDB ID, and a brief overview when using
search-json
Adding Shows
- Search for the show
- Present results with TVDB links
- User picks a number
- Add show (searches for episodes by default)
Parameters
add command
<tvdbId>: TVDB ID of the show (required)
profileId: Optional quality profile ID (defaults to first available profile)
--no-search: Don't search for episodes after adding
remove command
<tvdbId>: TVDB ID of the show (required)
--delete-files: Also delete media files (default: keep files)
Notes
- Requires network access to your Sonarr server
- Uses Sonarr API v3
- The
search-json command returns raw JSON; all other commands return formatted text.
- Quality profile IDs vary by installation — use
config to discover yours
- The
SONARR_DEFAULT_QUALITY_PROFILE from plugin settings (config.env) is used when adding shows (defaults to 1)
Reference
For detailed local reference, see: