Repository navigation
Add MCP tools to read and edit a media file's metadata - #132
Merged
Merged
Conversation
Add get_media_metadata (mcp:read) and update_media_metadata (mcp:write) MCP tools. Both share the admin PUT /admin/api/media/*path/metadata logic, now extracted to app/helpers/media-metadata-edit.ts: the same validation schema, the FFmpeg tag write (stream copy, atomic replace, other tags kept), and cache invalidation. Paths must resolve inside the configured media root (resolve + realpath containment, regular files only), which the admin endpoint now enforces too.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 24 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Why
Kody (and other MCP clients) can browse MediaRSS and manage feeds, but can't fix a file's tags. The only metadata editor is the admin UI/API behind Cloudflare Access. Follow-up to #131: some older General Conference talks need their
Estimated publishdescription line corrected so each talk gets a distinct, chronological pubDate.Change
app/helpers/media-metadata-edit.ts, extracted fromPUT /admin/api/media/*path/metadata. It holds the sameMetadataUpdateSchema(date staysYYYY/YYYY-MM/YYYY-MM-DD), the FFmpeg tag write (-c copy -map_metadata 0, atomic replace, so every other tag and the cover art is kept), cache invalidation, and the media detail response.resolveContainedMediaFilerequires the target to resolve inside the configured media root (path.resolveplusrealpath, so no..or symlink escape) and to be a regular file. The admin endpoint now uses it too. Before, it usedpath.join.app/mcp/media-metadata-tools.ts, registered frominitializeTools):get_media_metadata(mcp:read):{ mediaRoot, relativePath }returns the full metadata.update_media_metadata(mcp:write):{ mediaRoot, relativePath, ...fields }with any of title, author, description, date, genre, trackNumber, copyright, narrator, album, albumArtist, composer, publisher, discNumber, language, series, seriesPosition, encodedBy, subtitle. Only the fields passed are written.Tests
..traversal, absolute path, symlink escape, unknown root, directory, and missing file are all rejected.date, an empty update, and traversal all leave the file untouched.isErrorresults.npm run validatepasses locally (305 tests).