Skip to content

Commit 13b989e

Browse files
return json instead of markdown table for list deployments
1 parent e0c8a72 commit 13b989e

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

src/tools/atlasLocal/read/listDeployments.ts

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,18 @@ export class ListDeploymentsTool extends AtlasLocalToolBase {
2727
};
2828
}
2929

30-
// Turn the deployments into a markdown table
31-
const rows = deployments
32-
.map((deployment) => {
33-
return `${deployment.name || "Unknown"} | ${deployment.state} | ${deployment.mongodbVersion}`;
34-
})
35-
.join("\n");
30+
// Filter out the fields we want to return to the user
31+
// We don't want to return the entire deployment object because it contains too much data
32+
const deploymentsJson = deployments.map((deployment) => {
33+
return {
34+
name: deployment.name,
35+
state: deployment.state,
36+
mongodbVersion: deployment.mongodbVersion,
37+
};
38+
});
3639

3740
return {
38-
content: formatUntrustedData(
39-
`Found ${deployments.length} deployments:`,
40-
`Deployment Name | State | MongoDB Version
41-
----------------|----------------|----------------
42-
${rows}`
43-
),
41+
content: formatUntrustedData("Deployments", JSON.stringify(deploymentsJson)),
4442
};
4543
}
4644
}

0 commit comments

Comments
 (0)