@@ -465,3 +465,79 @@ async def test_list_directory_complex_glob_patterns(mcp_server, app):
465465 assert "Project Beta Plan.md" in list_text
466466 assert "Meeting Minutes" not in list_text
467467 assert "matching 'Project*'" in list_text
468+
469+
470+ @pytest .mark .asyncio
471+ async def test_list_directory_dot_slash_prefix_paths (mcp_server , app ):
472+ """Test directory listing with ./ prefix paths (reproduces bug report issue)."""
473+
474+ async with Client (mcp_server ) as client :
475+ # Create test files in a subdirectory
476+ await client .call_tool (
477+ "write_note" ,
478+ {
479+ "title" : "Artifact One" ,
480+ "folder" : "artifacts" ,
481+ "content" : "# Artifact One\n \n First artifact document." ,
482+ "tags" : "artifact,test" ,
483+ },
484+ )
485+
486+ await client .call_tool (
487+ "write_note" ,
488+ {
489+ "title" : "Artifact Two" ,
490+ "folder" : "artifacts" ,
491+ "content" : "# Artifact Two\n \n Second artifact document." ,
492+ "tags" : "artifact,test" ,
493+ },
494+ )
495+
496+ # Test normal path without ./ prefix (should work)
497+ normal_result = await client .call_tool (
498+ "list_directory" ,
499+ {
500+ "dir_name" : "artifacts" ,
501+ "depth" : 1 ,
502+ },
503+ )
504+
505+ assert len (normal_result .content ) == 1
506+ normal_text = normal_result .content [0 ].text
507+ assert "Artifact One.md" in normal_text
508+ assert "Artifact Two.md" in normal_text
509+ assert "2 files" in normal_text
510+
511+ # Test with ./ prefix (this was the failing case in the bug report)
512+ dot_slash_result = await client .call_tool (
513+ "list_directory" ,
514+ {
515+ "dir_name" : "./artifacts" ,
516+ "depth" : 1 ,
517+ },
518+ )
519+
520+ assert len (dot_slash_result .content ) == 1
521+ dot_slash_text = dot_slash_result .content [0 ].text
522+
523+ # Should show the same files as normal path
524+ assert "Artifact One.md" in dot_slash_text
525+ assert "Artifact Two.md" in dot_slash_text
526+ assert "2 files" in dot_slash_text
527+
528+ # Test with trailing slash after ./ prefix
529+ dot_slash_trailing_result = await client .call_tool (
530+ "list_directory" ,
531+ {
532+ "dir_name" : "./artifacts/" ,
533+ "depth" : 1 ,
534+ },
535+ )
536+
537+ assert len (dot_slash_trailing_result .content ) == 1
538+ dot_slash_trailing_text = dot_slash_trailing_result .content [0 ].text
539+
540+ # Should show the same files
541+ assert "Artifact One.md" in dot_slash_trailing_text
542+ assert "Artifact Two.md" in dot_slash_trailing_text
543+ assert "2 files" in dot_slash_trailing_text
0 commit comments