Skip to content

Commit c2f449f

Browse files
committed
fix: projects
1 parent ad7a657 commit c2f449f

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/tools/atlas/listProjects.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,14 @@ export class ListProjectsTool extends AtlasToolBase {
1111

1212
const data = await this.apiClient!.listProjects();
1313

14-
if (data?.results?.length) {
14+
if (!data?.results?.length) {
1515
throw new Error("No projects found in your MongoDB Atlas account.");
1616
}
1717

1818
// Format projects as a table
1919
const rows = data!
2020
.results!.map((project) => {
21-
const created = project.created as unknown as { $date: string };
22-
const createdAt = created ? new Date(created.$date).toLocaleString() : "N/A";
21+
const createdAt = project.created ? new Date(project.created).toLocaleString() : "N/A";
2322
return `${project.name} | ${project.id} | ${createdAt}`;
2423
})
2524
.join("\n");

0 commit comments

Comments
 (0)