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

mongodb-js / mongodb-mcp-server / 14735750222

29 Apr 2025 03:54PM UTC coverage: 78.141%. First build
14735750222

Pull #167

github

fmenezes
fix: issue template with title twice
Pull Request #167: fix: issue template with title twice

134 of 244 branches covered (54.92%)

Branch coverage included in aggregate %.

774 of 918 relevant lines covered (84.31%)

39.05 hits per line

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

31.43
/src/tools/atlas/atlasTool.ts
1
import { ToolBase, ToolCategory, TelemetryToolMetadata } from "../tool.js";
31✔
2
import { ToolCallback } from "@modelcontextprotocol/sdk/server/mcp.js";
3
import logger, { LogId } from "../../logger.js";
31✔
4
import { z } from "zod";
31✔
5

6
export abstract class AtlasToolBase extends ToolBase {
31✔
7
    protected category: ToolCategory = "atlas";
297✔
8

9
    protected verifyAllowed(): boolean {
10
        if (!this.config.apiClientId || !this.config.apiClientSecret) {
297✔
11
            return false;
220✔
12
        }
13
        return super.verifyAllowed();
77✔
14
    }
15

16
    /**
17
     *
18
     * Resolves the tool metadata from the arguments passed to the tool
19
     *
20
     * @param args - The arguments passed to the tool
21
     * @returns The tool metadata
22
     */
23
    protected resolveTelemetryMetadata(
24
        ...args: Parameters<ToolCallback<typeof this.argsShape>>
25
    ): TelemetryToolMetadata {
26
        const toolMetadata: TelemetryToolMetadata = {};
×
27
        if (!args.length) {
×
28
            return toolMetadata;
×
29
        }
30

31
        // Create a typed parser for the exact shape we expect
32
        const argsShape = z.object(this.argsShape);
×
33
        const parsedResult = argsShape.safeParse(args[0]);
×
34

35
        if (!parsedResult.success) {
×
36
            logger.debug(
×
37
                LogId.telemetryMetadataError,
38
                "tool",
39
                `Error parsing tool arguments: ${parsedResult.error.message}`
40
            );
41
            return toolMetadata;
×
42
        }
43

44
        const data = parsedResult.data;
×
45

46
        // Extract projectId using type guard
47
        if ("projectId" in data && typeof data.projectId === "string" && data.projectId.trim() !== "") {
×
48
            toolMetadata.projectId = data.projectId;
×
49
        }
50

51
        // Extract orgId using type guard
52
        if ("orgId" in data && typeof data.orgId === "string" && data.orgId.trim() !== "") {
×
53
            toolMetadata.orgId = data.orgId;
×
54
        }
55
        return toolMetadata;
×
56
    }
57
}
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