Skip to content

Commit 07eb375

Browse files
committed
Checkpoint from VS Code for coding agent session
1 parent dfbb803 commit 07eb375

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+145
-135
lines changed

src/lib.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export { Server, type ServerOptions } from "./server.js";
22
export { Session, type SessionOptions } from "./common/session.js";
3-
export { type UserConfig } from "./common/config.js";
3+
export { type UserConfig, UserConfigSchema } from "./common/config.js";
44
export { LoggerBase, type LogPayload, type LoggerType, type LogLevel } from "./common/logger.js";
55
export { StreamableHttpRunner } from "./transports/streamableHttp.js";
66
export {
@@ -21,3 +21,5 @@ export { ErrorCodes } from "./common/errors.js";
2121
export { Telemetry } from "./telemetry/telemetry.js";
2222
export { Keychain, registerGlobalSecretToRedact } from "./common/keychain.js";
2323
export type { Secret } from "./common/keychain.js";
24+
export type { TransportRunnerConfig } from "./transports/base.js";
25+
export { TransportRunnerBase } from "./transports/base.js";

src/server.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ export interface ServerOptions {
3838
export class Server {
3939
public readonly session: Session;
4040
public readonly mcpServer: McpServer;
41-
private readonly telemetry: Telemetry;
41+
public readonly telemetry: Telemetry;
4242
public readonly userConfig: UserConfig;
4343
public readonly elicitation: Elicitation;
44-
private readonly toolConstructors: (new (params: ToolConstructorParams) => ToolBase)[];
44+
public readonly toolConstructors: (new (params: ToolConstructorParams) => ToolBase)[];
4545
public readonly tools: ToolBase[] = [];
4646
public readonly connectionErrorHandler: ConnectionErrorHandler;
4747

@@ -221,6 +221,18 @@ export class Server {
221221
this.telemetry.emitEvents([event]);
222222
}
223223

224+
public getAvailableTools(): ToolBase[] {
225+
return this.toolConstructors.map(
226+
(toolConstructor) =>
227+
new toolConstructor({
228+
session: this.session,
229+
config: this.userConfig,
230+
telemetry: this.telemetry,
231+
elicitation: this.elicitation,
232+
})
233+
);
234+
}
235+
224236
private registerTools(): void {
225237
for (const toolConstructor of this.toolConstructors) {
226238
const tool = new toolConstructor({

src/tools/atlas/connect/connectCluster.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ export const ConnectClusterArgs = {
2929

3030
export class ConnectClusterTool extends AtlasToolBase {
3131
public name = "atlas-connect-cluster";
32-
protected description = "Connect to MongoDB Atlas cluster";
32+
public description = "Connect to MongoDB Atlas cluster";
3333
public operationType: OperationType = "connect";
34-
protected argsShape = {
34+
public argsShape = {
3535
...ConnectClusterArgs,
3636
};
3737

@@ -210,7 +210,7 @@ export class ConnectClusterTool extends AtlasToolBase {
210210
});
211211
}
212212

213-
protected async execute({
213+
public async execute({
214214
projectId,
215215
clusterName,
216216
connectionType,

src/tools/atlas/create/createAccessList.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ export const CreateAccessListArgs = {
1818

1919
export class CreateAccessListTool extends AtlasToolBase {
2020
public name = "atlas-create-access-list";
21-
protected description = "Allow Ip/CIDR ranges to access your MongoDB Atlas clusters.";
21+
public description = "Allow Ip/CIDR ranges to access your MongoDB Atlas clusters.";
2222
public operationType: OperationType = "create";
23-
protected argsShape = {
23+
public argsShape = {
2424
...CreateAccessListArgs,
2525
};
2626

27-
protected async execute({
27+
public async execute({
2828
projectId,
2929
ipAddresses,
3030
cidrBlocks,

src/tools/atlas/create/createDBUser.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ export const CreateDBUserArgs = {
3535

3636
export class CreateDBUserTool extends AtlasToolBase {
3737
public name = "atlas-create-db-user";
38-
protected description = "Create an MongoDB Atlas database user";
38+
public description = "Create an MongoDB Atlas database user";
3939
public operationType: OperationType = "create";
40-
protected argsShape = {
40+
public argsShape = {
4141
...CreateDBUserArgs,
4242
};
4343

44-
protected async execute({
44+
public async execute({
4545
projectId,
4646
username,
4747
password,

src/tools/atlas/create/createFreeCluster.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ import { AtlasArgs } from "../../args.js";
77

88
export class CreateFreeClusterTool extends AtlasToolBase {
99
public name = "atlas-create-free-cluster";
10-
protected description = "Create a free MongoDB Atlas cluster";
10+
public description = "Create a free MongoDB Atlas cluster";
1111
public operationType: OperationType = "create";
12-
protected argsShape = {
12+
public argsShape = {
1313
projectId: AtlasArgs.projectId().describe("Atlas project ID to create the cluster in"),
1414
name: AtlasArgs.clusterName().describe("Name of the cluster"),
1515
region: AtlasArgs.region().describe("Region of the cluster").default("US_EAST_1"),
1616
};
1717

18-
protected async execute({ projectId, name, region }: ToolArgs<typeof this.argsShape>): Promise<CallToolResult> {
18+
public async execute({ projectId, name, region }: ToolArgs<typeof this.argsShape>): Promise<CallToolResult> {
1919
const input = {
2020
groupId: projectId,
2121
name,

src/tools/atlas/create/createProject.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ import { AtlasArgs } from "../../args.js";
66

77
export class CreateProjectTool extends AtlasToolBase {
88
public name = "atlas-create-project";
9-
protected description = "Create a MongoDB Atlas project";
9+
public description = "Create a MongoDB Atlas project";
1010
public operationType: OperationType = "create";
11-
protected argsShape = {
11+
public argsShape = {
1212
projectName: AtlasArgs.projectName().optional().describe("Name for the new project"),
1313
organizationId: AtlasArgs.organizationId().optional().describe("Organization ID for the new project"),
1414
};
1515

16-
protected async execute({ projectName, organizationId }: ToolArgs<typeof this.argsShape>): Promise<CallToolResult> {
16+
public async execute({ projectName, organizationId }: ToolArgs<typeof this.argsShape>): Promise<CallToolResult> {
1717
let assumedOrg = false;
1818

1919
if (!projectName) {

src/tools/atlas/read/getPerformanceAdvisor.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ const PerformanceAdvisorOperationType = z.enum([
2323

2424
export class GetPerformanceAdvisorTool extends AtlasToolBase {
2525
public name = "atlas-get-performance-advisor";
26-
protected description = `Get MongoDB Atlas performance advisor recommendations, which includes the operations: suggested indexes, drop index suggestions, schema suggestions, and a sample of the most recent (max ${DEFAULT_SLOW_QUERY_LOGS_LIMIT}) slow query logs`;
26+
public description = `Get MongoDB Atlas performance advisor recommendations, which includes the operations: suggested indexes, drop index suggestions, schema suggestions, and a sample of the most recent (max ${DEFAULT_SLOW_QUERY_LOGS_LIMIT}) slow query logs`;
2727
public operationType: OperationType = "read";
28-
protected argsShape = {
28+
public argsShape = {
2929
projectId: AtlasArgs.projectId().describe(
3030
"Atlas project ID to get performance advisor recommendations. The project ID is a hexadecimal identifier of 24 characters. If the user has only specified the name, use the `atlas-list-projects` tool to retrieve the user's projects with their ids."
3131
),
@@ -47,7 +47,7 @@ export class GetPerformanceAdvisorTool extends AtlasToolBase {
4747
.optional(),
4848
};
4949

50-
protected async execute({
50+
public async execute({
5151
projectId,
5252
clusterName,
5353
operations,

src/tools/atlas/read/inspectAccessList.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ export const InspectAccessListArgs = {
99

1010
export class InspectAccessListTool extends AtlasToolBase {
1111
public name = "atlas-inspect-access-list";
12-
protected description = "Inspect Ip/CIDR ranges with access to your MongoDB Atlas clusters.";
12+
public description = "Inspect Ip/CIDR ranges with access to your MongoDB Atlas clusters.";
1313
public operationType: OperationType = "read";
14-
protected argsShape = {
14+
public argsShape = {
1515
...InspectAccessListArgs,
1616
};
1717

18-
protected async execute({ projectId }: ToolArgs<typeof this.argsShape>): Promise<CallToolResult> {
18+
public async execute({ projectId }: ToolArgs<typeof this.argsShape>): Promise<CallToolResult> {
1919
const accessList = await this.session.apiClient.listProjectIpAccessLists({
2020
params: {
2121
path: {

src/tools/atlas/read/inspectCluster.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ export const InspectClusterArgs = {
1212

1313
export class InspectClusterTool extends AtlasToolBase {
1414
public name = "atlas-inspect-cluster";
15-
protected description = "Inspect MongoDB Atlas cluster";
15+
public description = "Inspect MongoDB Atlas cluster";
1616
public operationType: OperationType = "read";
17-
protected argsShape = {
17+
public argsShape = {
1818
...InspectClusterArgs,
1919
};
2020

21-
protected async execute({ projectId, clusterName }: ToolArgs<typeof this.argsShape>): Promise<CallToolResult> {
21+
public async execute({ projectId, clusterName }: ToolArgs<typeof this.argsShape>): Promise<CallToolResult> {
2222
const cluster = await inspectCluster(this.session.apiClient, projectId, clusterName);
2323

2424
return this.formatOutput(cluster);

0 commit comments

Comments
 (0)