-
-
Notifications
You must be signed in to change notification settings - Fork 14.6k
🐛 fix: support audio file uploads in MCP content processing #11223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
- Add inferContentTypeFromUrl utility function that supports both image and audio files - Modify FileService.uploadBase64 to accept skipCheckFileType parameter - Update MCP content processor to use skipCheckFileType for audio files - Add comprehensive tests for new utility function Fixes the "Invalid image url" error when MCP returns audio content by bypassing image-only file type validation for audio files, following the same pattern as TTS uploads. Fixes #10778 🤖 Generated with [Claude Code](https://claude.ai/code) Co-authored-by: Arvin Xu <arvinxx@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Reviewer's GuideAdds a generic URL-based content-type inference utility, updates file upload logic to optionally bypass image-only validation for audio (used by MCP audio uploads), and introduces tests to cover the new MIME inference behavior for images and audio. Sequence diagram for MCP audio upload content processingsequenceDiagram
participant MCPContentProcessor
participant FileService
participant UrlUtils
MCPContentProcessor->>FileService: uploadBase64(audioData, audioPathname, options_skipCheckFileType_true)
activate FileService
alt skipCheckFileType_true
FileService->>UrlUtils: inferContentTypeFromUrl(audioPathname)
UrlUtils-->>FileService: audio_mime_type
else skipCheckFileType_false
FileService->>UrlUtils: inferContentTypeFromImageUrl(pathname)
UrlUtils-->>FileService: image_mime_type
end
FileService-->>MCPContentProcessor: url_with_uploaded_audio
deactivate FileService
Updated class diagram for FileService uploadBase64 and URL MIME utilitiesclassDiagram
class FileService {
+uploadBase64(base64Data: string, pathname: string, options: UploadBase64Options): Promise_FileUploadResult
}
class UploadBase64Options {
+skipCheckFileType: boolean
}
class Promise_FileUploadResult {
+fileId: string
+key: string
+url: string
}
class UrlUtils {
+inferContentTypeFromImageUrl(url: string): string
+inferContentTypeFromUrl(url: string): string
}
FileService --> UploadBase64Options : uses
FileService --> Promise_FileUploadResult : returns
FileService --> UrlUtils : calls
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## next #11223 +/- ##
==========================================
- Coverage 77.57% 74.63% -2.94%
==========================================
Files 1118 887 -231
Lines 84636 67969 -16667
Branches 11224 7265 -3959
==========================================
- Hits 65656 50730 -14926
+ Misses 18980 17239 -1741
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Fixes the "Invalid image url" error when MCP returns audio content by bypassing image-only file type validation for audio files, following the same pattern as TTS uploads.
Changes
Closes #10778
Generated with Claude Code
Summary by Sourcery
Support MCP audio file uploads by relaxing image-only content type validation and improving MIME type inference from URLs.
New Features:
Bug Fixes:
Enhancements:
Tests: