Skip to content

Commit 1c567e5

Browse files
committed
fix: format
1 parent fa7cae3 commit 1c567e5

File tree

3 files changed

+53
-32
lines changed

3 files changed

+53
-32
lines changed

scripts/apply.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ async function main() {
5050

5151
let requiredParams = !!operation.requestBody;
5252
let hasResponseBody = false;
53-
for(const code in operation.responses) {
53+
for (const code in operation.responses) {
5454
try {
5555
const httpCode = parseInt(code, 10);
5656
if (httpCode >= 200 && httpCode < 300) {
@@ -91,8 +91,12 @@ async function main() {
9191
const { operationId, method, path, requiredParams, hasResponseBody } = operation;
9292
return `async ${operationId}(options${requiredParams ? "" : "?"}: FetchOptions<operations["${operationId}"]>) {
9393
${hasResponseBody ? `const { data } = ` : ``}await this.client.${method}("${path}", options);
94-
${hasResponseBody ? `return data;
95-
` : ``}}
94+
${
95+
hasResponseBody
96+
? `return data;
97+
`
98+
: ``
99+
}}
96100
`;
97101
})
98102
.join("\n");
@@ -101,7 +105,7 @@ async function main() {
101105
const templateLines = templateFile.split("\n");
102106
let outputLines: string[] = [];
103107
let addLines = true;
104-
for(const line of templateLines) {
108+
for (const line of templateLines) {
105109
if (line.includes("DO NOT EDIT. This is auto-generated code.")) {
106110
addLines = !addLines;
107111
outputLines.push(line);

src/tools/atlas/listClusters.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ export class ListClustersTool extends AtlasToolBase {
5858
if (!formattedClusters.length) {
5959
throw new Error("No clusters found.");
6060
}
61-
const rows = formattedClusters.map((cluster) => {
61+
const rows = formattedClusters
62+
.map((cluster) => {
6263
return `${cluster.groupName} (${cluster.groupId}) | ${cluster.name}`;
6364
})
6465
.join("\n");

tests/integration/tools/atlas/atlas.test.ts

Lines changed: 43 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ describeAtlas("tools", () => {
2323
});
2424

2525
it("returns project names", async () => {
26-
const response = (await integration.mcpClient().callTool({ name: "atlas-list-projects", arguments: {} })) as CallToolResult;
26+
const response = (await integration
27+
.mcpClient()
28+
.callTool({ name: "atlas-list-projects", arguments: {} })) as CallToolResult;
2729
expect(response.content).toBeArray();
2830
expect(response.content).toHaveLength(1);
2931
expect(response.content[0].text).toContain("MCP Test");
@@ -45,8 +47,8 @@ describeAtlas("tools", () => {
4547
groupId: projectId,
4648
username: "testuser-" + randomId,
4749
databaseName: "admin",
48-
}
49-
}
50+
},
51+
},
5052
});
5153
});
5254

@@ -76,7 +78,7 @@ describeAtlas("tools", () => {
7678
databaseName: "admin",
7779
},
7880
],
79-
}
81+
},
8082
})) as CallToolResult;
8183
expect(response.content).toBeArray();
8284
expect(response.content).toHaveLength(1);
@@ -93,7 +95,9 @@ describeAtlas("tools", () => {
9395
expect(listDbUsers.inputSchema.properties).toHaveProperty("projectId");
9496
});
9597
it("returns database users by project", async () => {
96-
const response = (await integration.mcpClient().callTool({ name: "atlas-list-db-users", arguments: { projectId } })) as CallToolResult;
98+
const response = (await integration
99+
.mcpClient()
100+
.callTool({ name: "atlas-list-db-users", arguments: { projectId } })) as CallToolResult;
97101
expect(response.content).toBeArray();
98102
expect(response.content).toHaveLength(1);
99103
expect(response.content[0].text).toContain("testuser-" + randomId);
@@ -113,26 +117,26 @@ describeAtlas("tools", () => {
113117
path: {
114118
groupId: projectId,
115119
entryValue: ipInfo.currentIpv4Address,
116-
}
117-
}
120+
},
121+
},
118122
});
119123

120124
await session.apiClient.deleteProjectIpAccessList({
121125
params: {
122126
path: {
123127
groupId: projectId,
124128
entryValue: "8.8.8.8",
125-
}
126-
}
129+
},
130+
},
127131
});
128132

129133
await session.apiClient.deleteProjectIpAccessList({
130134
params: {
131135
path: {
132136
groupId: projectId,
133137
entryValue: "9.9.9.9/24",
134-
}
135-
}
138+
},
139+
},
136140
});
137141
});
138142

@@ -157,8 +161,8 @@ describeAtlas("tools", () => {
157161
projectId,
158162
ipAddresses: ["8.8.8.8"],
159163
cidrBlocks: ["9.9.9.9/24"],
160-
currentIpAddress: true
161-
}
164+
currentIpAddress: true,
165+
},
162166
})) as CallToolResult;
163167
expect(response.content).toBeArray();
164168
expect(response.content).toHaveLength(1);
@@ -181,7 +185,9 @@ describeAtlas("tools", () => {
181185
session.ensureAuthenticated();
182186
const ipInfo = await session.apiClient.getIpInfo();
183187

184-
const response = (await integration.mcpClient().callTool({ name: "atlas-inspect-access-list", arguments: { projectId } })) as CallToolResult;
188+
const response = (await integration
189+
.mcpClient()
190+
.callTool({ name: "atlas-inspect-access-list", arguments: { projectId } })) as CallToolResult;
185191
expect(response.content).toBeArray();
186192
expect(response.content).toHaveLength(1);
187193
expect(response.content[0].text).toContain("8.8.8.8");
@@ -200,9 +206,9 @@ describeAtlas("tools", () => {
200206
path: {
201207
groupId: projectId,
202208
clusterName: "ClusterTest-" + randomId,
203-
}
209+
},
204210
},
205-
})
211+
});
206212
});
207213

208214
describe("atlas-create-free-cluster", () => {
@@ -220,11 +226,12 @@ describeAtlas("tools", () => {
220226

221227
it("should create a free cluster", async () => {
222228
const response = (await integration.mcpClient().callTool({
223-
name: "atlas-create-free-cluster", arguments: {
229+
name: "atlas-create-free-cluster",
230+
arguments: {
224231
projectId,
225232
name: "ClusterTest-" + randomId,
226233
region: "US_EAST_1",
227-
}
234+
},
228235
})) as CallToolResult;
229236
expect(response.content).toBeArray();
230237
expect(response.content).toHaveLength(1);
@@ -235,17 +242,22 @@ describeAtlas("tools", () => {
235242
describe("atlas-inspect-cluster", () => {
236243
it("should have correct metadata", async () => {
237244
const { tools } = await integration.mcpClient().listTools();
238-
const inspectCluster = tools.find((tool) => tool.name === "atlas-inspect-cluster")!;
245+
const inspectCluster = tools.find((tool) => tool.name === "atlas-inspect-cluster")!;
239246

240-
expect(inspectCluster).toBeDefined();
241-
expect(inspectCluster.inputSchema.type).toBe("object");
242-
expect(inspectCluster.inputSchema.properties).toBeDefined();
243-
expect(inspectCluster.inputSchema.properties).toHaveProperty("projectId");
244-
expect(inspectCluster.inputSchema.properties).toHaveProperty("clusterName");
247+
expect(inspectCluster).toBeDefined();
248+
expect(inspectCluster.inputSchema.type).toBe("object");
249+
expect(inspectCluster.inputSchema.properties).toBeDefined();
250+
expect(inspectCluster.inputSchema.properties).toHaveProperty("projectId");
251+
expect(inspectCluster.inputSchema.properties).toHaveProperty("clusterName");
245252
});
246253

247254
it("returns cluster data", async () => {
248-
const response = (await integration.mcpClient().callTool({ name: "atlas-inspect-cluster", arguments: { projectId, clusterName: "ClusterTest-" + randomId } })) as CallToolResult;
255+
const response = (await integration
256+
.mcpClient()
257+
.callTool({
258+
name: "atlas-inspect-cluster",
259+
arguments: { projectId, clusterName: "ClusterTest-" + randomId },
260+
})) as CallToolResult;
249261
expect(response.content).toBeArray();
250262
expect(response.content).toHaveLength(1);
251263
expect(response.content[0].text).toContain(`ClusterTest-${randomId} | `);
@@ -263,14 +275,18 @@ describeAtlas("tools", () => {
263275
});
264276

265277
it("returns clusters by project", async () => {
266-
const response = (await integration.mcpClient().callTool({ name: "atlas-list-clusters", arguments: { projectId } })) as CallToolResult;
278+
const response = (await integration
279+
.mcpClient()
280+
.callTool({ name: "atlas-list-clusters", arguments: { projectId } })) as CallToolResult;
267281
expect(response.content).toBeArray();
268282
expect(response.content).toHaveLength(2);
269283
expect(response.content[1].text).toContain(`ClusterTest-${randomId} | `);
270284
});
271285

272286
it("returns clusters for all projects", async () => {
273-
const response = (await integration.mcpClient().callTool({ name: "atlas-list-clusters", arguments: { } })) as CallToolResult;
287+
const response = (await integration
288+
.mcpClient()
289+
.callTool({ name: "atlas-list-clusters", arguments: {} })) as CallToolResult;
274290
expect(response.content).toBeArray();
275291
expect(response.content).toHaveLength(1);
276292
expect(response.content[0].text).toContain(` | ClusterTest-${randomId}`);

0 commit comments

Comments
 (0)