• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mongodb-js / mongodb-mcp-server / 18911327516

29 Oct 2025 02:27PM UTC coverage: 80.317% (+0.09%) from 80.227%
18911327516

Pull #653

github

web-flow
Merge c9247e7ad into 01f799ccb
Pull Request #653: chore: update atlas tools output to json - MCP-264

1349 of 1815 branches covered (74.33%)

Branch coverage included in aggregate %.

37 of 60 new or added lines in 6 files covered. (61.67%)

2 existing lines in 2 files now uncovered.

6343 of 7762 relevant lines covered (81.72%)

71.36 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

83.64
/src/tools/atlas/read/listDBUsers.ts
1
import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
2
import { AtlasToolBase } from "../atlasTool.js";
3✔
3
import type { ToolArgs, OperationType } from "../../tool.js";
4
import { formatUntrustedData } from "../../tool.js";
3✔
5
import { AtlasArgs } from "../../args.js";
3✔
6

7
export const ListDBUsersArgs = {
3✔
8
    projectId: AtlasArgs.projectId().describe("Atlas project ID to filter DB users"),
3✔
9
};
3✔
10

11
export class ListDBUsersTool extends AtlasToolBase {
3✔
12
    public name = "atlas-list-db-users";
84✔
13
    protected description = "List MongoDB Atlas database users";
84✔
14
    public operationType: OperationType = "read";
84✔
15
    protected argsShape = {
84✔
16
        ...ListDBUsersArgs,
84✔
17
    };
84✔
18

19
    protected async execute({ projectId }: ToolArgs<typeof this.argsShape>): Promise<CallToolResult> {
3✔
20
        const data = await this.session.apiClient.listDatabaseUsers({
1✔
21
            params: {
1✔
22
                path: {
1✔
23
                    groupId: projectId,
1✔
24
                },
1✔
25
            },
1✔
26
        });
1✔
27

28
        if (!data?.results?.length) {
1!
29
            return {
×
30
                content: [{ type: "text", text: " No database users found" }],
×
31
            };
×
32
        }
×
33

34
        const users = data.results.map((user) => ({
1✔
35
            username: user.username,
1✔
36
            roles:
1✔
37
                user.roles?.map((role) => ({
1✔
38
                    roleName: role.roleName,
1✔
39
                    databaseName: role.databaseName,
1✔
40
                    collectionName: role.collectionName,
1✔
41
                })) ?? [],
1!
42
            scopes:
1✔
43
                user.scopes?.map((scope) => ({
1✔
NEW
44
                    type: scope.type,
×
NEW
45
                    name: scope.name,
×
46
                })) ?? [],
1!
47
        }));
1✔
48

49
        return {
1✔
50
            content: formatUntrustedData(
1✔
51
                `Found ${data.results.length} database users in project ${projectId}`,
1✔
52
                JSON.stringify(users)
1✔
53
            ),
1✔
54
        };
1✔
55
    }
1✔
56
}
3✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc