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

mongodb-js / mongodb-mcp-server / 14671884465

25 Apr 2025 07:17PM UTC coverage: 67.88% (-14.6%) from 82.446%
14671884465

Pull #134

github

web-flow
chore(deps-dev): bump mongodb-runner from 5.8.2 to 5.8.3

Bumps [mongodb-runner](https://github.com/mongodb-js/devtools-shared) from 5.8.2 to 5.8.3.
- [Commits](https://github.com/mongodb-js/devtools-shared/commits)

---
updated-dependencies:
- dependency-name: mongodb-runner
  dependency-version: 5.8.3
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Pull Request #134: chore(deps-dev): bump mongodb-runner from 5.8.2 to 5.8.3

99 of 212 branches covered (46.7%)

Branch coverage included in aggregate %.

628 of 859 relevant lines covered (73.11%)

43.31 hits per line

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

25.93
/src/tools/atlas/read/listDBUsers.ts
1
import { z } from "zod";
31✔
2
import { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
3
import { AtlasToolBase } from "../atlasTool.js";
31✔
4
import { ToolArgs, OperationType } from "../../tool.js";
5
import { DatabaseUserRole, UserScope } from "../../../common/atlas/openapi.js";
6

7
export class ListDBUsersTool extends AtlasToolBase {
31✔
8
    protected name = "atlas-list-db-users";
23✔
9
    protected description = "List MongoDB Atlas database users";
23✔
10
    protected operationType: OperationType = "read";
23✔
11
    protected argsShape = {
23✔
12
        projectId: z.string().describe("Atlas project ID to filter DB users"),
13
    };
14

15
    protected async execute({ projectId }: ToolArgs<typeof this.argsShape>): Promise<CallToolResult> {
16
        const data = await this.session.apiClient.listDatabaseUsers({
×
17
            params: {
18
                path: {
19
                    groupId: projectId,
20
                },
21
            },
22
        });
23

24
        if (!data?.results?.length) {
×
25
            throw new Error("No database users found.");
×
26
        }
27

28
        const output =
29
            `Username | Roles | Scopes
×
30
----------------|----------------|----------------
31
` +
32
            data.results
33
                .map((user) => {
34
                    return `${user.username} | ${formatRoles(user.roles)} | ${formatScopes(user.scopes)}`;
×
35
                })
36
                .join("\n");
37
        return {
×
38
            content: [{ type: "text", text: output }],
39
        };
40
    }
41
}
42

43
function formatRoles(roles?: DatabaseUserRole[]) {
44
    if (!roles?.length) {
×
45
        return "N/A";
×
46
    }
47
    return roles
×
48
        .map(
49
            (role) =>
50
                `${role.roleName}${role.databaseName ? `@${role.databaseName}${role.collectionName ? `:${role.collectionName}` : ""}` : ""}`
×
51
        )
52
        .join(", ");
53
}
54

55
function formatScopes(scopes?: UserScope[]) {
56
    if (!scopes?.length) {
×
57
        return "All";
×
58
    }
59
    return scopes.map((scope) => `${scope.type}:${scope.name}`).join(", ");
×
60
}
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