search
Search across configured *arr libraries and TRaSH Guides reference profiles using natural language queries for media discovery.
Instructions
Search across configured *arr libraries plus TRaSH Guides reference profiles. This is the primary discovery tool for remote MCP clients such as ChatGPT.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Natural-language search query |
Implementation Reference
- src/index.ts:98-111 (schema)Schema (inputSchema) for the 'search' tool: requires a 'query' string property. Defines the tool's name and input contract.
{ name: "search", description: "Search across configured *arr libraries plus TRaSH Guides reference profiles. This is the primary discovery tool for remote MCP clients such as ChatGPT.", inputSchema: { type: "object" as const, properties: { query: { type: "string", description: "Natural-language search query", }, }, required: ["query"], }, }, - src/index.ts:1141-1145 (handler)Handler for the 'search' tool in the CallToolRequestSchema switch statement. Extracts 'query' from args, calls runUnifiedSearch(query), and returns results as JSON.
case "search": { const query = (args as { query: string }).query; const results = await runUnifiedSearch(query); return jsonText({ results }); } - src/index.ts:931-1003 (helper)runUnifiedSearch() helper function that performs the actual search logic: searches TRaSH profile names/descriptions, Sonarr series, Radarr movies, and Lidarr artists, returning up to 5 results from each source.
async function runUnifiedSearch(query: string): Promise<SearchEntry[]> { const results: SearchEntry[] = []; const trimmedQuery = query.trim(); if (trimmedQuery.length === 0) { return results; } const lowerQuery = trimmedQuery.toLowerCase(); for (const service of ["radarr", "sonarr"] as const) { const profiles = await trashClient.listProfiles(service); results.push( ...profiles .filter((profile) => profile.name.toLowerCase().includes(lowerQuery) || profile.description?.toLowerCase().includes(lowerQuery) ) .slice(0, 8) .map((profile) => ({ id: `trash-profile:${service}:${profile.name}`, title: `${profile.name} (${service})`, url: buildResourceUrl(`trash/profile/${service}/${encodeURIComponent(profile.name)}`), type: "trash_profile", service, summary: profile.description?.replace(/<br>/g, " "), })) ); } if (clients.sonarr) { const series = await clients.sonarr.searchSeries(trimmedQuery); results.push( ...series.slice(0, 5).map((item) => ({ id: `arr:sonarr:series:${item.tvdbId}`, title: `${item.title}${item.year ? ` (${item.year})` : ""}`, url: buildResourceUrl(`arr/sonarr/series/${item.tvdbId}`), type: "series", service: "sonarr", summary: item.overview?.slice(0, 220), })) ); } if (clients.radarr) { const movies = await clients.radarr.searchMovies(trimmedQuery); results.push( ...movies.slice(0, 5).map((item) => ({ id: `arr:radarr:movie:${item.tmdbId}`, title: `${item.title}${item.year ? ` (${item.year})` : ""}`, url: buildResourceUrl(`arr/radarr/movie/${item.tmdbId}`), type: "movie", service: "radarr", summary: item.overview?.slice(0, 220), })) ); } if (clients.lidarr) { const artists = await clients.lidarr.searchArtists(trimmedQuery); results.push( ...artists.slice(0, 5).map((item) => ({ id: `arr:lidarr:artist:${item.foreignArtistId}`, title: item.artistName || item.title, url: buildResourceUrl(`arr/lidarr/artist/${item.foreignArtistId}`), type: "artist", service: "lidarr", summary: item.overview?.slice(0, 220), })) ); } return results; - src/index.ts:85-126 (registration)Registration of tools including 'search' in the TOOLS array. The 'search' tool is listed among the core general tools (arr_status, search, fetch).
const TOOLS: Tool[] = [ // General tool available for all { name: "arr_status", description: configuredServices.length > 0 ? `Get status of all configured *arr services. Currently configured: ${configuredServices.map(s => s.displayName).join(', ')}` : "Get status of all supported *arr services. No local *arr services are currently configured, but TRaSH reference tools remain available.", inputSchema: { type: "object" as const, properties: {}, required: [], }, }, { name: "search", description: "Search across configured *arr libraries plus TRaSH Guides reference profiles. This is the primary discovery tool for remote MCP clients such as ChatGPT.", inputSchema: { type: "object" as const, properties: { query: { type: "string", description: "Natural-language search query", }, }, required: ["query"], }, }, { name: "fetch", description: "Fetch a specific item returned by search. Accepts an opaque item id from the search tool.", inputSchema: { type: "object" as const, properties: { id: { type: "string", description: "Opaque result id returned by search", }, }, required: ["id"], }, }, ];