feat(mcp): add directory listing sorting - #1268
Merged
Merged
Conversation
Signed-off-by: phernandez <paul@basicmachines.co>
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
The hosted MCP project and folder browser needs one exact-depth directory read that includes both child folders and notes while supporting title and updated-time sorting.
Core previously exposed only its legacy filename ordering, forcing Cloud to use a notes-only fallback for non-default sorts and lose folder cards. This closes #1267 and unblocks the one-read navigation work in basic-memory-cloud#1764.
What Changed
title_asc,title_desc,updated_asc, andupdated_descsort contract to the directory API and typed MCP client.list_directoryMCP tool without re-sorting the API response.Implementation Details
sortpreserves the existing filename-based ordering for compatibility.Testing
Automated
uv run pytest tests/services/test_directory_service.py tests/api/v2/test_directory_router.py tests/mcp/clients/test_clients.py tests/mcp/test_tool_contracts.py tests/mcp/test_tool_list_directory.py -q: 88 passeduv run pytest tests/services/test_directory_service.py tests/mcp/test_tool_list_directory.py -q: 47 passeduv run pytest tests/mcp/test_tool_contracts.py -q: 5 passeduv run pytest test-int/read_cache/test_api_read_cache.py::test_directory_reads_cache_then_project_invalidation_refreshes -q: 1 passedjust fast-check: passedjust typecheck: passedjust doctor: passedjust test-smoke: 1 passedManual
Risks / Follow-ups