Make listfiles entry path relative to base directory#15
Merged
Conversation
The 'path' field on each entry was previously relative to the listed subdirectory, which caused callers (and LLMs) to fail when passing it back to mcpproxy__getfile — the parent prefix was missing for nested entries. Anchor 'path' to the base files directory so it is always directly usable with getfile, and call that out in the tool description.
The listing renderer and the follow-up getfile call both used 'name' (basename), so files inside subdirectories were shown without their parent prefix and the getfile lookup failed. Use 'path' (relative to the base files directory) — which the listfiles tool now returns — falling back to 'name' for compatibility.
Use a generic 'test-paths' subdirectory and verify both a base-level file and a nested file round-trip through list_files -> get_file using only the returned 'path' field, both when listing the subdir directly and when listing the root recursively.
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.
The 'path' field on each entry was previously relative to the listed subdirectory, which caused callers (and LLMs) to fail when passing it back to mcpproxy__getfile — the parent prefix was missing for nested entries. Anchor 'path' to the base files directory so it is always directly usable with getfile, and call that out in the tool description.