get_transcript
Retrieve podcast episode transcripts by providing show name and episode number. Access text content from Jupiter Broadcasting podcasts for analysis or reference.
Instructions
Get the transcript for a specific episode.
Args: show_name: Name of the show episode_number: Episode number
Returns: Dictionary containing the transcript text or error message.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| show_name | Yes | ||
| episode_number | Yes |
Implementation Reference
- podcast_mcp/server.py:109-127 (handler)Primary MCP tool handler registered with @mcp.tool(). Delegates to rss_parser.get_transcript, handles errors, and formats the response as a dictionary.@mcp.tool() def get_transcript(show_name: str, episode_number: str) -> Dict[str, Any]: """Get the transcript for a specific episode. Args: show_name: Name of the show episode_number: Episode number Returns: Dictionary containing the transcript text or error message. """ try: transcript = rss_parser.get_transcript(show_name, episode_number) if transcript: return {"transcript": transcript} else: return {"error": f"Transcript not available for episode '{episode_number}' in show '{show_name}'"} except Exception as e: return {"error": f"Failed to retrieve transcript: {str(e)}"}
- podcast_mcp/rss_parser.py:197-213 (helper)Core implementation logic: retrieves the episode data, extracts the transcript URL, fetches and returns the transcript text.def get_transcript(self, show_name: str, episode_number: str) -> Optional[str]: """Get transcript for an episode.""" episode = self.get_episode(show_name, episode_number) if not episode: return None transcript_url = episode.get("transcript_url") if not transcript_url: return None try: response = requests.get(transcript_url, timeout=30) response.raise_for_status() return response.text except Exception as e: print(f"Error fetching transcript: {e}") return None
- podcast_mcp/rss_parser.py:277-292 (helper)Extracts podcast:transcript XML elements during episode parsing to populate transcript_url used by get_transcript.transcript_elems = item.findall('.//{https://podcastindex.org/namespace/1.0}transcript') for transcript in transcript_elems: transcript_url = transcript.get("url") transcript_type = transcript.get("type", "") if transcript_url: episode_data["transcript_urls"].append({ "url": transcript_url, "type": transcript_type, "language": transcript.get("language", "en-us") }) # For backward compatibility, set transcript_url to the first available transcript if episode_data["transcript_urls"]: episode_data["transcript_url"] = episode_data["transcript_urls"][0]["url"] else: episode_data["transcript_url"] = None
- podcast_mcp/server.py:109-109 (registration)Explicit registration of the get_transcript tool using FastMCP decorator.@mcp.tool()
- podcast_mcp/rss_parser.py:176-194 (helper)Supporting function to locate the specific episode by GUID or podcast:episode number, required by get_transcript.def get_episode(self, show_name: str, episode_number: str) -> Optional[Dict[str, Any]]: """Get specific episode data.""" feed_root = self._get_feed(show_name) if feed_root is None: return None # Find all item elements (episodes) items = feed_root.xpath('//item') for item in items: # Check GUID guid_elem = item.find('guid') if guid_elem is not None and guid_elem.text == episode_number: return self._parse_episode(show_name, item) # Check podcast:episode number episode_elem = item.find('.//{https://podcastindex.org/namespace/1.0}episode') if episode_elem is not None and episode_elem.text == episode_number: return self._parse_episode(show_name, item)