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

mongodb-js / mongodb-mcp-server / 14621147270

23 Apr 2025 02:47PM UTC coverage: 75.13% (-3.3%) from 78.42%
14621147270

Pull #87

github

blva
chore: reformat
Pull Request #87: feat: core telemetry functionality

100 of 188 branches covered (53.19%)

Branch coverage included in aggregate %.

51 of 90 new or added lines in 8 files covered. (56.67%)

16 existing lines in 4 files now uncovered.

622 of 773 relevant lines covered (80.47%)

37.2 hits per line

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

90.0
/src/session.ts
1
import { NodeDriverServiceProvider } from "@mongosh/service-provider-node-driver";
2
import { ApiClient, ApiClientCredentials } from "./common/atlas/apiClient.js";
18✔
3
import { Implementation } from "@modelcontextprotocol/sdk/types.js";
4
import config from "./config.js";
18✔
5

6
export class Session {
18✔
7
    sessionId?: string;
8
    serviceProvider?: NodeDriverServiceProvider;
9
    apiClient: ApiClient;
10
    agentRunner?: {
11
        name: string;
12
        version: string;
13
    };
14

15
    constructor() {
16
        const credentials: ApiClientCredentials | undefined =
17
            config.apiClientId && config.apiClientSecret
18!
18
                ? {
19
                      clientId: config.apiClientId,
20
                      clientSecret: config.apiClientSecret,
21
                  }
22
                : undefined;
23

24
        this.apiClient = new ApiClient({
18✔
25
            baseUrl: config.apiBaseUrl,
26
            credentials,
27
        });
28
    }
29

30
    setAgentRunner(agentRunner: Implementation | undefined) {
31
        if (agentRunner?.name && agentRunner?.version) {
18✔
32
            this.agentRunner = {
18✔
33
                name: agentRunner.name,
34
                version: agentRunner.version,
35
            };
36
        }
37
    }
38

39
    async close(): Promise<void> {
40
        if (this.serviceProvider) {
170✔
41
            try {
101✔
42
                await this.serviceProvider.close(true);
101✔
43
            } catch (error) {
UNCOV
44
                console.error("Error closing service provider:", error);
×
45
            }
46
            this.serviceProvider = undefined;
101✔
47
        }
48
    }
49
}
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

© 2026 Coveralls, Inc