search_episodes
Find podcast episodes by show, date, hosts, or content within Jupiter Broadcasting's catalog using specific search criteria.
Instructions
Search for episodes based on various criteria. At least one search parameter must be provided.
Args: show_name: Name of the specific show to search in (required) since_date: Only return episodes published on or after this date (YYYY-MM-DD or ISO format) before_date: Only return episodes published before this date (YYYY-MM-DD or ISO format) hosts: List of host names to filter by text_search: Search text to match against episode titles and descriptions
Returns: List of episodes matching the search criteria.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| show_name | Yes | ||
| since_date | No | ||
| before_date | No | ||
| hosts | No | ||
| text_search | No |
Input Schema (JSON Schema)
Implementation Reference
- podcast_mcp/server.py:35-67 (handler)MCP tool handler for 'search_episodes', registered via @mcp.tool() decorator. Handles input parameters, calls the RSS parser helper, and manages errors.@mcp.tool() def search_episodes( show_name: str, since_date: Optional[str] = None, before_date: Optional[str] = None, hosts: Optional[List[str]] = None, text_search: Optional[str] = None, ) -> List[Dict[str, Any]]: """Search for episodes based on various criteria. At least one search parameter must be provided. Args: show_name: Name of the specific show to search in (required) since_date: Only return episodes published on or after this date (YYYY-MM-DD or ISO format) before_date: Only return episodes published before this date (YYYY-MM-DD or ISO format) hosts: List of host names to filter by text_search: Search text to match against episode titles and descriptions Returns: List of episodes matching the search criteria. """ try: return rss_parser.search_episodes( show_name=show_name, since_date=since_date, before_date=before_date, hosts=hosts, text_search=text_search, ) except ValueError as e: return [{"error": str(e)}] except Exception as e: return [{"error": f"Search failed: {str(e)}"}]
- podcast_mcp/rss_parser.py:114-175 (helper)Core helper method in PodcastRSSParser that implements the episode search logic: fetches and parses RSS feeds, extracts episodes, and applies filters for dates, hosts, and text search.def search_episodes( self, show_name: Optional[str] = None, since_date: Optional[str] = None, before_date: Optional[str] = None, hosts: Optional[List[str]] = None, text_search: Optional[str] = None, ) -> List[Dict[str, Any]]: """Search episodes based on provided criteria.""" if not any([show_name, since_date, before_date, hosts, text_search]): raise ValueError("At least one search parameter must be provided") results = [] # Determine which shows to search shows_to_search = [show_name] if show_name else self.get_shows() # Parse date filters since_dt = None before_dt = None if since_date: since_dt = self._parse_date(since_date) if before_date: before_dt = self._parse_date(before_date) for show in shows_to_search: feed_root = self._get_feed(show) if feed_root is None: continue # Find all item elements (episodes) items = feed_root.xpath('//item') for item in items: episode_data = self._parse_episode(show, item) # Apply filters if since_dt and episode_data.get("published_date"): episode_dt = self._parse_date(episode_data["published_date"]) if episode_dt and episode_dt < since_dt: continue if before_dt and episode_data.get("published_date"): episode_dt = self._parse_date(episode_data["published_date"]) if episode_dt and episode_dt > before_dt: continue if hosts: episode_hosts = episode_data.get("hosts", []) if not any(host.lower() in [h.lower() for h in episode_hosts] for host in hosts): continue if text_search: search_text = text_search.lower() title = episode_data.get("title", "").lower() description = episode_data.get("description", "").lower() if search_text not in title and search_text not in description: continue results.append(episode_data) return results