Add get_episode_info and list_recent_episodes tools#3
Open
jonathanmoore wants to merge 1 commit into
Open
Conversation
Two new MCP tools that expand TLDL beyond "give me the transcript": - get_episode_info(url): returns markdown with metadata frontmatter and a description body, no transcript fetched. Useful for confirming an episode or referencing it cheaply. Works for YouTube (full metadata via yt-dlp), Apple (full metadata via iTunes Lookup), and Spotify (limited to title + show via oEmbed). - list_recent_episodes(url, limit=10): returns a numbered markdown list of recent episodes/videos with titles, dates, and durations. Works for Apple show URLs (iTunes Lookup), YouTube channel and playlist URLs (yt-dlp). Bare YouTube channel URLs are auto-resolved to the /videos tab so we get actual videos instead of sub-tabs. Spotify show URLs return an explicit "not supported" error since Spotify has no public episodes API. Implementation: - apple.py: factored out _itunes_fetch and _episode_to_info helpers; refactored _itunes_lookup to use them; added fetch_apple_episode_info and list_apple_episodes - youtube.py: added list_youtube_videos with bare-channel /videos auto-append; fetch_youtube_metadata now also returns description - spotify.py: added fetch_spotify_episode_info (oEmbed-based) - markdown.py: added render_episode_info and render_episode_list formatters that reuse the existing frontmatter helpers - server.py: registered both new @mcp.tool functions; added URL-pattern helpers (_is_youtube_video_url, _is_apple_episode_url, _YOUTUBE_LISTABLE_RE) for clear cross-tool error messages Smoke-tested all combinations: - get_episode_info on YouTube/Apple/Spotify episodes (all return appropriate metadata) - get_episode_info on Apple show URL → clean ToolError - list_recent_episodes on Apple show URL → 5 recent DOAC episodes - list_recent_episodes on YouTube channel @LexClips → 3 recent videos - list_recent_episodes on YouTube video URL → clean ToolError - list_recent_episodes on Spotify URL → "not supported" message - get_transcript still works (regression check passed) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two new MCP tools that expand TLDL beyond "give me the transcript":
get_episode_info(url)— metadata-only response, no transcript. Useful when you want to confirm "is this the right episode?" or just reference an episode cheaply.list_recent_episodes(url, limit=10)— discovery. Numbered markdown list of recent episodes/videos with titles, dates, durations.What's new
get_episode_infolist_recent_episodes?i=is ignored if presentextract_flat/videosso you get videos instead of sub-tabslimitis capped at 50.Implementation
apple.py: factored out_itunes_fetch+_episode_to_info, refactored existing_itunes_lookupto share them, addedfetch_apple_episode_infoandlist_apple_episodesyoutube.py:list_youtube_videoswith bare-channel/videosauto-append;fetch_youtube_metadatanow also returnsdescriptionspotify.py:fetch_spotify_episode_info(oEmbed-based)markdown.py:render_episode_infoandrender_episode_listformatters reusing existing frontmatter helpersserver.py: registered both new@mcp.toolfunctions with cross-tool error helpers (e.g. show URL passed toget_episode_infogets a "use list_recent_episodes" message)Test plan
Smoke-tested against the live local server:
get_episode_infoon YouTube video → full metadataget_episode_infoon Apple episode (DOAC Christianity ep) → full metadata, 2:26:56 duration, release date, descriptionget_episode_infoon Spotify episode → title + show only (limited as documented)get_episode_infoon Apple show URL (no?i=) → clean "use list_recent_episodes" errorlist_recent_episodeson Apple show (DOAC) → 5 recent episodes with dates and durationslist_recent_episodeson YouTube channel@LexClips→ 3 recent videos (after/videosauto-append fix)list_recent_episodeson YouTube video URL → clean "pass a channel URL" errorlist_recent_episodeson Spotify URL → "not supported" messageget_transcriptstill works (regression check)tools/listreturns all three tools with descriptions🤖 Generated with Claude Code