Repository navigation
feat(filesystem): add head/tail support to read_multiple_files - #4025
factspark23-hash wants to merge 1 commit into
Conversation
Add per-file head/tail line limits when reading multiple files. - head: returns only the first N lines of each file - tail: returns only the last N lines of each file - Cannot use both simultaneously (throws error) - Backward compatible: omitting both reads full files Useful for previewing large log files, checking file headers, or sampling content from many files at once.
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 optional
headandtailparameters to theread_multiple_filestool, allowing line-limited reads across multiple files at once.Why
The single-file
read_text_filealready supportsheadandtail, butread_multiple_filesdoes not. When working with multiple large files (logs, configs, data files), agents often only need the first/last N lines of each.Currently the only option is to call
read_text_filewith head/tail N times, which is slower and more verbose.How
head— returns only the first N lines of each filetail— returns only the last N lines of each fileread_text_file)Changes
src/filesystem/index.ts:headandtailtoReadMultipleFilesArgsSchemaheadFile/tailFilefrom lib.tsread_text_file)