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

mongodb-js / mongodb-mcp-server / 14637601756

24 Apr 2025 08:57AM UTC coverage: 42.737% (-32.7%) from 75.474%
14637601756

Pull #103

github

fmenezes
fix: rename describes
Pull Request #103: refactor: split test helpers

30 of 187 branches covered (16.04%)

Branch coverage included in aggregate %.

376 of 763 relevant lines covered (49.28%)

1.85 hits per line

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

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

5
export interface SessionOptions {
6
    apiBaseUrl?: string;
7
    apiClientId?: string;
8
    apiClientSecret?: string;
9
}
10

11
export class Session {
1✔
12
    sessionId?: string;
13
    serviceProvider?: NodeDriverServiceProvider;
14
    apiClient: ApiClient;
15
    agentRunner?: {
16
        name: string;
17
        version: string;
18
    };
19

20
    constructor({ apiBaseUrl, apiClientId, apiClientSecret }: SessionOptions = {}) {
×
21
        const credentials: ApiClientCredentials | undefined =
22
            apiClientId && apiClientSecret
2✔
23
                ? {
24
                      clientId: apiClientId,
25
                      clientSecret: apiClientSecret,
26
                  }
27
                : undefined;
28

29
        this.apiClient = new ApiClient({
2✔
30
            baseUrl: apiBaseUrl,
31
            credentials,
32
        });
33
    }
34

35
    setAgentRunner(agentRunner: Implementation | undefined) {
36
        if (agentRunner?.name && agentRunner?.version) {
2✔
37
            this.agentRunner = {
2✔
38
                name: agentRunner.name,
39
                version: agentRunner.version,
40
            };
41
        }
42
    }
43

44
    async close(): Promise<void> {
45
        if (this.serviceProvider) {
2!
46
            try {
×
47
                await this.serviceProvider.close(true);
×
48
            } catch (error) {
49
                console.error("Error closing service provider:", error);
×
50
            }
51
            this.serviceProvider = undefined;
×
52
        }
53
    }
54
}
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