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

mongodb-js / mongodb-mcp-server / 14623052485

23 Apr 2025 04:17PM UTC coverage: 78.69% (+0.3%) from 78.42%
14623052485

Pull #101

github

fmenezes
fix: rebase
Pull Request #101: refactor: move configuration to be passed

93 of 162 branches covered (57.41%)

Branch coverage included in aggregate %.

22 of 22 new or added lines in 10 files covered. (100.0%)

568 of 678 relevant lines covered (83.78%)

31.06 hits per line

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

70.0
/src/tools/mongodb/update/renameCollection.ts
1
import { z } from "zod";
18✔
2
import { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
3
import { MongoDBToolBase } from "../mongodbTool.js";
18✔
4
import { ToolArgs, OperationType } from "../../tool.js";
5

6
export class RenameCollectionTool extends MongoDBToolBase {
18✔
7
    protected name = "rename-collection";
19✔
8
    protected description = "Renames a collection in a MongoDB database";
19✔
9
    protected argsShape = {
19✔
10
        collection: z.string().describe("Collection name"),
11
        database: z.string().describe("Database name"),
12
        newName: z.string().describe("The new name for the collection"),
13
        dropTarget: z.boolean().optional().default(false).describe("If true, drops the target collection if it exists"),
14
    };
15
    protected operationType: OperationType = "update";
19✔
16

17
    protected async execute({
18
        database,
19
        collection,
20
        newName,
21
        dropTarget,
22
    }: ToolArgs<typeof this.argsShape>): Promise<CallToolResult> {
23
        const provider = await this.ensureConnected();
×
24
        const result = await provider.renameCollection(database, collection, newName, {
×
25
            dropTarget,
26
        });
27

28
        return {
×
29
            content: [
30
                {
31
                    text: `Collection \`${collection}\` renamed to \`${result.collectionName}\` in database \`${database}\`.`,
32
                    type: "text",
33
                },
34
            ],
35
        };
36
    }
37
}
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