Skip to content

Commit 5c660da

Browse files
chore: made eslint happy
1 parent 4900b02 commit 5c660da

File tree

4 files changed

+23
-19
lines changed

4 files changed

+23
-19
lines changed

src/tools/atlasLocal/atlasLocalTool.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
22
import type { TelemetryToolMetadata, ToolArgs, ToolCategory } from "../tool.js";
33
import { ToolBase } from "../tool.js";
4-
import { ToolCallback } from "@modelcontextprotocol/sdk/server/mcp.js";
4+
import type { ToolCallback } from "@modelcontextprotocol/sdk/server/mcp.js";
55
import type AtlasLocal from "@mongodb-js-preview/atlas-local";
66

77
export abstract class AtlasLocalToolBase extends ToolBase {
@@ -27,6 +27,7 @@ export abstract class AtlasLocalToolBase extends ToolBase {
2727
...args: Parameters<ToolCallback<typeof this.argsShape>>
2828
): TelemetryToolMetadata {
2929
// TODO: include deployment id in the metadata where possible
30+
void args; // this shuts up the eslint rule until we implement the TODO above
3031
return {};
3132
}
3233
}

src/tools/atlasLocal/read/listDeployments.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
22
import { AtlasLocalToolBase } from "../atlasLocalTool.js";
3-
import type { ToolArgs, OperationType, TelemetryToolMetadata } from "../../tool.js";
3+
import type { OperationType } from "../../tool.js";
44
import { formatUntrustedData } from "../../tool.js";
55
import type { Deployment } from "@mongodb-js-preview/atlas-local";
66

@@ -10,7 +10,7 @@ export class ListDeploymentsTool extends AtlasLocalToolBase {
1010
public operationType: OperationType = "read";
1111
protected argsShape = {};
1212

13-
protected async execute({}: ToolArgs<typeof this.argsShape>): Promise<CallToolResult> {
13+
protected async execute(): Promise<CallToolResult> {
1414
// Get the client
1515
const client = this.client;
1616

@@ -20,18 +20,15 @@ export class ListDeploymentsTool extends AtlasLocalToolBase {
2020
if (!client) {
2121
throw new Error("Atlas Local client not found, tool should have been disabled.");
2222
}
23-
23+
2424
// List the deployments
2525
const deployments = await client.listDeployments();
2626

2727
// Format the deployments
2828
return this.formatDeploymentsTable(deployments);
2929
}
3030

31-
32-
private formatDeploymentsTable(
33-
deployments: Deployment[]
34-
): CallToolResult {
31+
private formatDeploymentsTable(deployments: Deployment[]): CallToolResult {
3532
// Check if deployments are absent
3633
if (!deployments?.length) {
3734
return {
@@ -42,10 +39,10 @@ export class ListDeploymentsTool extends AtlasLocalToolBase {
4239
// Turn the deployments into a markdown table
4340
const rows = deployments
4441
.map((deployment) => {
45-
return `${deployment.name || "Unknown"} | ${deployment.state} | ${deployment.mongodbVersion}`
42+
return `${deployment.name || "Unknown"} | ${deployment.state} | ${deployment.mongodbVersion}`;
4643
})
4744
.join("\n");
48-
45+
4946
return {
5047
content: formatUntrustedData(
5148
`Found ${deployments.length} deployments:`,

src/tools/atlasLocal/tools.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ import type AtlasLocal from "@mongodb-js-preview/atlas-local";
55
const atlasLocalTools = [ListDeploymentsTool];
66

77
// Build the Atlas Local tools
8-
export const BuildAtlasLocalTools = async () => {
8+
export const BuildAtlasLocalTools = async (): Promise<typeof atlasLocalTools> => {
99
// Initialize the Atlas Local client
1010
const client = await GetAtlasLocalClient();
1111

1212
// If the client is found, set it on the tools
1313
// On unsupported platforms, the client will be undefined
1414
if (client) {
1515
// Set the client on the tools
16-
atlasLocalTools.forEach(tool => {
16+
atlasLocalTools.forEach((tool) => {
1717
tool.prototype.client = client;
1818
});
1919
}
@@ -30,4 +30,4 @@ export const GetAtlasLocalClient = async (): Promise<AtlasLocal.Client | undefin
3030
console.warn("Atlas Local native binding not available:", error);
3131
return undefined;
3232
}
33-
}
33+
};

tests/integration/tools/atlas-local/listDeployments.test.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
1-
import { defaultDriverOptions, defaultTestConfig, expectDefined, getResponseElements, setupIntegrationTest } from "../../helpers.js";
1+
import {
2+
defaultDriverOptions,
3+
defaultTestConfig,
4+
expectDefined,
5+
getResponseElements,
6+
setupIntegrationTest,
7+
} from "../../helpers.js";
28
import { describe, expect, it } from "vitest";
39

4-
5-
610
describe("atlas-local-list-deployments", () => {
711
const integration = setupIntegrationTest(
812
() => defaultTestConfig,
913
() => defaultDriverOptions
1014
);
11-
15+
1216
it("should have correct metadata", async () => {
1317
const { tools } = await integration.mcpClient().listTools();
1418
const listDeployments = tools.find((tool) => tool.name === "atlas-local-list-deployments");
@@ -26,6 +30,8 @@ describe("atlas-local-list-deployments", () => {
2630
const elements = getResponseElements(response.content);
2731
expect(elements).toHaveLength(2);
2832
expect(elements[0]?.text).toMatch(/Found \d+ deployments/);
29-
expect(elements[1]?.text).toContain("Deployment Name | State | MongoDB Version\n----------------|----------------|----------------\n");
33+
expect(elements[1]?.text).toContain(
34+
"Deployment Name | State | MongoDB Version\n----------------|----------------|----------------\n"
35+
);
3036
});
31-
});
37+
});

0 commit comments

Comments
 (0)