feat: Add compare_directories tool for directory comparison#3890
Open
nagual2 wants to merge 7 commits intomodelcontextprotocol:mainfrom
Open
feat: Add compare_directories tool for directory comparison#3890nagual2 wants to merge 7 commits intomodelcontextprotocol:mainfrom
nagual2 wants to merge 7 commits intomodelcontextprotocol:mainfrom
Conversation
… usage, add types
…archFilesWithValidation calls
olaservo
requested changes
Apr 12, 2026
Member
olaservo
left a comment
There was a problem hiding this comment.
Thanks for the contribution. A couple of implementation issues and a scope question:
Implementation issues:
- The
compareContentparameter is accepted in the schema and function signature but never used — comparison always uses size/mtime regardless of the flag. Either implement content comparison or remove the parameter. - Files with identical content but different timestamps will be reported as "different," and files with different content but the same size/mtime will be reported as "identical." This should at least be documented clearly, or addressed with actual content hashing when
compareContentis true.
Scope question:
Per our CONTRIBUTING.md, we're selective about new features that aren't core to a server's purpose. Directory comparison feels like it could be composed by an LLM using existing tools (directory_tree, read_file), or handled by a dedicated server. Would you consider publishing this as a standalone MCP server on the Registry instead?
This review was assisted by Claude Code.
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
Adds
compare_directoriestool to filesystem MCP server for comparing two directory structures.New Tool:
compare_directoriesCompares two directories and returns:
Changes
src/filesystem/lib.ts- AddedcompareDirectories()functionsrc/filesystem/index.ts- Registered toolsrc/filesystem/__tests__/lib.test.ts- Added 6 testsTests
✅ Files unique to each directory
✅ Content difference detection
✅ Identical file identification
✅ Empty directory handling
✅ Nested structures
All tests pass with
npm test.