๐ Major Release - MCP Best Practices & Quality Improvements
This release represents a significant upgrade with comprehensive MCP best practices implementation, following the official MCP server development guidelines.
โจ Added
Tool Naming & Organization
- Tool Name Prefixes: All tools now have
ytdlp_prefix to avoid naming conflicts with other MCP serverssearch_videosโytdlp_search_videosdownload_videoโytdlp_download_videoget_video_metadataโytdlp_get_video_metadata- And all other tools similarly prefixed
Input Validation
- Zod Schema Validation: Implemented runtime input validation for all 8 tools
- URL validation with proper format checking
- String length constraints (min/max)
- Number range validation
- Regex patterns for language codes and time formats
- Enum validation for resolution and format options
.strict()mode to prevent unexpected fields
Tool Annotations
- MCP Tool Hints: Added comprehensive annotations to all tools
readOnlyHint: truefor read-only operations (search, list, get)readOnlyHint: falsefor file-creating operations (downloads)destructiveHint: falsefor all tools (no destructive updates)idempotentHint: true/falsebased on operation typeopenWorldHint: truefor all tools (external API interactions)
Response Formats
- Flexible Output Formats: Added
response_formatparameter to search tools- JSON format: Structured data for programmatic processing
- Markdown format: Human-readable display (default)
- Both formats include pagination metadata
Pagination Support
- Search Pagination: Added offset parameter to
ytdlp_search_videosoffsetparameter for skipping resultshas_moreindicator in responsesnext_offsetfor easy pagination- Works with both JSON and Markdown formats
Character Limits & Truncation
- Response Size Protection: Implemented character limits to prevent context overflow
- Standard limit: 25,000 characters
- Transcript limit: 50,000 characters (larger for text content)
- Automatic truncation with clear messages
- Smart truncation that preserves JSON validity
Error Messages
- Actionable Error Guidance: Improved error messages across all modules
- Platform-specific errors (Unsupported URL, Video unavailable, etc.)
- Network error guidance with retry suggestions
- Language availability hints (e.g., "Use ytdlp_list_subtitle_languages to check options")
- Rate limit handling with wait time suggestions
๐ง Improved
Tool Descriptions
- Comprehensive Documentation: Enhanced all tool descriptions with:
- Clear purpose statements
- Detailed parameter descriptions with examples
- Complete return value schemas
- "Use when" / "Don't use when" guidance
- Error handling documentation
- Example use cases
Configuration
- Enhanced Config System: Added new configuration options
limits.characterLimit: Maximum response size (25,000)limits.maxTranscriptLength: Maximum transcript size (50,000)- Environment variable support for all settings
Code Quality
- Better Type Safety: Improved TypeScript types throughout
- Proper type definitions for metadata with truncation fields
- Explicit Promise return types
- Better error type handling
๐ Fixed
- JSON Parsing Issue: Fixed metadata truncation that was breaking JSON format
- Truncation messages now inside JSON objects instead of appended
- Prevents "Unexpected non-whitespace character" errors
- Maintains valid JSON structure even when truncated
๐งช Testing
- Real-World Validation: Comprehensive testing with actual videos
- โ YouTube platform fully tested (Rick Astley - Never Gonna Give You Up)
- โ Bilibili platform fully tested (Chinese content)
- โ Multi-language support verified (English, Chinese)
- โ All 8 tools tested with real API calls
- โ MCP protocol compatibility verified
๐ Platform Support
- Verified Platforms:
- โ YouTube (fully tested)
- โ Bilibili (ๅๅฉๅๅฉ) (fully tested)
- ๐ฏ 1000+ other platforms supported via yt-dlp
๐ Statistics
- 8 tools with complete Zod validation
- 8 tools with proper annotations
- 8 tools with comprehensive descriptions
- 2 platforms tested and verified
- 5/5 YouTube tests passing
- 3/3 Bilibili tests passing
- 0 critical bugs remaining
๐ Migration Guide
If upgrading from 0.6.x:
-
Tool Names: Update all tool names to include
ytdlp_prefix
```diff- "search_videos"
- "ytdlp_search_videos"
```
-
Search Parameters: New optional parameters available
```javascript
{
query: "tutorial",
maxResults: 10,
offset: 0, // NEW: pagination support
response_format: "json" // NEW: format control
}
``` -
Error Handling: Error messages are more descriptive now
- Update any error parsing logic to handle new formats
๐ Acknowledgments
This release follows the MCP Server Development Best Practices and incorporates feedback from the MCP community.
Full Changelog: v0.6.28...v0.7.0