Repository navigation
feat(filesystem): add compare_files tool for file diff comparison - #4024
factspark23-hash wants to merge 1 commit into
Conversation
New tool that compares two files and returns a unified diff output. - Shows exactly what changed between two files - Configurable context lines (default: 3) - Reports when files are identical - Uses existing createUnifiedDiff utility - Both files must be within allowed directories Useful for code review, change verification, and understanding differences between file versions.
LuuOW
left a comment
There was a problem hiding this comment.
Technical audit: Verified MCP server implementation for consistency with current SDK patterns.
|
Thank you for this pull request, and apologies for the long wait for a response. These servers are reference implementations: they exist to show how each part of MCP is used, not to be general-purpose products, so new features are taken selectively, and this change isn't one the maintainers plan to take. This repository also now accepts issues, not pull requests, from anyone but its maintainers; the policy is in This is not a judgment on the idea or on you. A server in the MCP Registry may well offer it, and anyone is welcome to build on these servers to do so. If you think we've misread it, please open an issue describing the problem and the expected behavior. This is part of the backlog triage in #4875. |
What
Add a new
compare_filestool that compares two files and returns a unified diff.Why
Currently there is no way to compare two files through MCP. Users often need to:
Without this tool, agents must read both files entirely and manually diff them, which is inefficient and error-prone.
How
Returns unified diff output, or reports files as identical.
Changes
src/filesystem/index.ts:CompareFilesArgsSchemawithfile1,file2,contextLinesparamscompare_filestool using existingcreateUnifiedDifffrom lib.ts