Home directory handling

This commit is contained in:
2026-09-22 12:51:28 -07:00
parent 43fbd8a834
commit 73a06f3c94
+2 -2
View File
@@ -19,7 +19,7 @@ async def handle(args: Dict[str, Any]):
if not path_str: if not path_str:
raise ToolError("Missing path argument") raise ToolError("Missing path argument")
path = Path(path_str) path = Path(path_str).expanduser()
if not path.is_dir(): if not path.is_dir():
raise ToolError(f"{path_str} is not a directory.") raise ToolError(f"{path_str} is not a directory.")
@@ -59,6 +59,6 @@ async def handle(args: Dict[str, Any]):
size_kb = item["size"] / 1024 size_kb = item["size"] / 1024
output.append(f" {item['name']} | {size_kb:.1f}KB | {mtime_rel}") output.append(f" {item['name']} | {size_kb:.1f}KB | {mtime_rel}")
header = f"Listing of {path_str}\nPage {effective_page} of {total_pages} ({total_items} total items). Showing {start_idx+1}-{min(end_idx, total_items)}." header = f"Listing of {path}\nPage {effective_page} of {total_pages} ({total_items} total items). Showing {start_idx+1}-{min(end_idx, total_items)}."
return [{"type": "text", "text": f"{header}\n\n" + "\n".join(output)}] return [{"type": "text", "text": f"{header}\n\n" + "\n".join(output)}]